Show
Ignore:
Timestamp:
02/24/05 23:03:38 (8 years ago)
Author:
minaguib
Message:

Better logging of details and calling of mark_* (auth+online/offline)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/wifidog/src/util.c

    r469 r478  
    113113                free(h_addr); 
    114114                UNLOCK_GHBN(); 
    115                 mark_offline(); 
    116115                return NULL; 
    117116        } 
     
    156155 
    157156void mark_online() { 
    158         int isonline; 
    159         isonline = is_online(); 
     157        int before; 
     158        int after; 
     159 
     160        before = is_online(); 
    160161        time(&last_online_time); 
    161         if (!isonline) { 
    162                 debug(LOG_INFO, "ONLINE status changed to ON"); 
    163         } 
     162        after = is_online(); 
     163 
     164        if (before != after) { 
     165                debug(LOG_INFO, "ONLINE status became %s", (after ? "ON" : "OFF")); 
     166        } 
     167 
    164168} 
    165169 
    166170void mark_offline() { 
    167         int isonline; 
    168         isonline = is_online(); 
     171        int before; 
     172        int after; 
     173 
     174        before = is_online(); 
    169175        time(&last_offline_time); 
     176        after = is_online(); 
     177 
     178        if (before != after) { 
     179                debug(LOG_INFO, "ONLINE status became %s", (after ? "ON" : "OFF")); 
     180        } 
     181 
    170182        /* If we're offline it definately means the auth server is offline */ 
    171183        mark_auth_offline(); 
    172         if (isonline) { 
    173                 debug(LOG_INFO, "ONLINE status changed to OFF"); 
    174         } 
     184 
    175185} 
    176186 
     
    187197 
    188198void mark_auth_online() { 
    189         int isauthonline; 
    190         isauthonline = is_auth_online(); 
     199        int before; 
     200        int after; 
     201 
     202        before = is_auth_online(); 
    191203        time(&last_auth_online_time); 
     204        after = is_auth_online(); 
     205 
     206        if (before != after) { 
     207                debug(LOG_INFO, "AUTH_ONLINE status became %s", (after ? "ON" : "OFF")); 
     208        } 
     209 
    192210        /* If auth server is online it means we're definately online */ 
    193211        mark_online(); 
    194         if (!isauthonline) { 
    195                 debug(LOG_INFO, "AUTH_ONLINE status changed to ON"); 
    196         } 
     212 
    197213} 
    198214 
    199215void mark_auth_offline() { 
    200         int isauthonline; 
    201         isauthonline = is_auth_online(); 
     216        int before; 
     217        int after; 
     218 
     219        before = is_auth_online(); 
    202220        time(&last_auth_offline_time); 
    203         if (isauthonline) { 
    204                 debug(LOG_INFO, "AUTH_ONLINE status changed to OFF"); 
    205         } 
     221        after = is_auth_online(); 
     222 
     223        if (before != after) { 
     224                debug(LOG_INFO, "AUTH_ONLINE status became %s", (after ? "ON" : "OFF")); 
     225        } 
     226 
    206227} 
    207228