When finding a realm by IP address, if we find it, then
authoraland <aland>
Thu, 20 Sep 2001 18:22:38 +0000 (18:22 +0000)
committeraland <aland>
Thu, 20 Sep 2001 18:22:38 +0000 (18:22 +0000)
we mark it as active.

This allows 'dead' realms to be immediately resurrected when
they start sending replies.

src/main/files.c

index d4d2493..42726ae 100644 (file)
@@ -540,13 +540,14 @@ REALM *realm_find(const char *realm)
                 */
                if (strcmp(cl->realm, realm) == 0) {
                        return cl;
-                       
-                       /*
-                        *      No default realm, try to set one.
-                        */
-               } else if ((default_realm == NULL) &&
-                          (strcmp(cl->realm, "DEFAULT") == 0)) {
-                       default_realm = cl;
+               }
+
+               /*
+                *      No default realm, try to set one.
+                */
+               if ((default_realm == NULL) &&
+                   (strcmp(cl->realm, "DEFAULT") == 0)) {
+                 default_realm = cl;
                }
        } /* loop over all realms */
 
@@ -565,9 +566,17 @@ REALM *realm_findbyaddr(uint32_t ipaddr)
 {
        REALM *cl;
 
+       /*
+        *      Note that we do NOT check for inactive realms!
+        *
+        *      If we get a packet from an end server, then we mark it
+        *      as active, and return the realm.
+        */
        for(cl = realms; cl != NULL; cl = cl->next)
-               if (ipaddr == cl->ipaddr)
+               if (ipaddr == cl->ipaddr) {
+                       cl->active = TRUE;
                        return cl;
+               }
 
        return NULL;
 }