white space :) added some log lines
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 6 Mar 2006 22:47:05 +0000 (22:47 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 6 Mar 2006 22:47:05 +0000 (22:47 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@3276 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/c-apps/oils_auth.c
Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm
OpenSRF/src/libstack/osrf_cache.c

index 15986e2..f560dd0 100644 (file)
@@ -394,6 +394,7 @@ oilsEvent*  _oilsAuthResetTimeout( char* authToken ) {
        jsonObject* cacheObj = osrfCacheGetObject( key ); 
 
        if(!cacheObj) {
+               osrfLogError(OSRF_LOG_MARK, "No user in the cache exists with key %s", key);
                evt = oilsNewEvent(OILS_EVENT_NO_SESSION);
 
        } else {
@@ -425,29 +426,37 @@ int oilsAuthSessionRetrieve( osrfMethodContext* ctx ) {
 
        char* authToken = jsonObjectGetString( jsonObjectGetIndex(ctx->params, 0));
        jsonObject* cacheObj = NULL;
+       oilsEvent* evt = NULL;
 
        if( authToken ){
 
-               if(1) {
-                       oilsEvent* evt = _oilsAuthResetTimeout(authToken);
-                       if( evt && strcmp(evt->event, OILS_EVENT_SUCCESS) ) {
-                               osrfAppRespondComplete( ctx, oilsEventToJSON(evt) );
+               evt = _oilsAuthResetTimeout(authToken);
+
+               if( evt && strcmp(evt->event, OILS_EVENT_SUCCESS) ) {
+                       osrfAppRespondComplete( ctx, oilsEventToJSON(evt) );
+                       oilsEventFree(evt);
+
+               } else {
+
+                       osrfLogDebug(OSRF_LOG_MARK, "Retrieving auth session: %s", authToken);
+                       char* key = va_list_to_string("%s%s", OILS_AUTH_CACHE_PRFX, authToken ); 
+                       cacheObj = osrfCacheGetObject( key ); 
+                       if(cacheObj) {
+                               osrfAppRespondComplete( ctx, jsonObjectGetKey( cacheObj, "userobj"));
+                               jsonObjectFree(cacheObj);
+                       } else {
+                               oilsEvent* evt = oilsNewEvent(OILS_EVENT_NO_SESSION);
+                               osrfAppRespondComplete( ctx, oilsEventToJSON(evt) ); /* should be event.. */
                                oilsEventFree(evt);
                        }
+                       free(key);
                }
 
-               osrfLogDebug(OSRF_LOG_MARK, "Retrieving auth session: %s", authToken);
-               char* key = va_list_to_string("%s%s", OILS_AUTH_CACHE_PRFX, authToken ); 
-               cacheObj = osrfCacheGetObject( key ); 
-               if(cacheObj) {
-                       osrfAppRespondComplete( ctx, jsonObjectGetKey( cacheObj, "userobj"));
-                       jsonObjectFree(cacheObj);
-               } else {
-                       oilsEvent* evt = oilsNewEvent(OILS_EVENT_NO_SESSION);
-                       osrfAppRespondComplete( ctx, oilsEventToJSON(evt) ); /* should be event.. */
-                       oilsEventFree(evt);
-               }
-               free(key);
+       } else {
+
+               evt = oilsNewEvent(OILS_EVENT_NO_SESSION);
+               osrfAppRespondComplete( ctx, oilsEventToJSON(evt) );
+               oilsEventFree(evt);
        }
 
        return 0;
index 7936ca0..13cb272 100644 (file)
@@ -60,6 +60,7 @@ jsonObject* osrfCacheGetObject( char* key, ... ) {
                        obj = jsonParseString( data );
                        return obj;
                }
+               osrfLogWarning(OSRF_LOG_MARK, "No cache data exists with key %s", VA_BUF);
        }
        return NULL;
 }
@@ -69,6 +70,7 @@ char* osrfCacheGetString( char* key, ... ) {
                VA_LIST_TO_STRING(key);
                char* data = (char*) mc_aget(__osrfCache, VA_BUF, strlen(VA_BUF) );
                osrfLogInternal( OSRF_LOG_MARK, "osrfCacheGetObject(): Returning object: %s", data);
+               if(!data) osrfLogWarning(OSRF_LOG_MARK, "No cache data exists with key %s", VA_BUF);
                return data;
        }
        return NULL;