Send resume notifications to previous owner server when client resumes.
authorSkywing <skywing@valhallalegends.com>
Sat, 13 Dec 2008 18:43:25 +0000 (13:43 -0500)
committerSkywing <skywing@valhallalegends.com>
Sat, 13 Dec 2008 18:46:01 +0000 (13:46 -0500)
Previously, resume notifications were broadcast to all routers, but not
necessarily the original owner of a particular detached user.  This
caused various breakage when a user was previously homed at a plain
server and then resumed at a router server, as the users previous home
server would never have been properly notified about the resume.

apps/silcd/packet_receive.c

index 5a49ca314e2cc1bd7fdd2eb7091a417955f26211..ac8156106e02c5616018027769623d1ff4fe015b 100644 (file)
@@ -3951,6 +3951,23 @@ void silc_server_resume_client(SilcServer server,
                              FALSE, TRUE);
     }
 
+    /* If the client has a locally-connected previous owner, then we
+       will need to notify them that the resume has completed.  Note
+       that if the previous owner was a router, this case is already
+       handled above by the broadcast, so we shouldn't attempt to
+       send another notification in that case.   Additionally, if
+       the previous owner was the server that sent the packet, then
+       we'll not send the notification as it will have already done
+       the necessary work locally. */
+    if (server->server_type == SILC_ROUTER &&
+       idata->conn_type == SILC_CONN_SERVER &&
+       detached_client->router &&
+       SILC_IS_LOCAL(detached_client->router) &&
+       detached_client->router->server_type != SILC_ROUTER)
+      silc_server_packet_send(server, detached_client->router->connection,
+                             SILC_PACKET_RESUME_CLIENT, 0,
+                             buffer->data, silc_buffer_len(buffer));
+
     /* Client is detached, and now it is resumed.  Remove the detached
        mode and mark that it is resumed. */