SilcFSMThread fsm; /* Notify FSM thread */
SilcChannelEntry channel; /* Channel entry being resolved */
SilcClientEntry client_entry; /* Client entry being resolved */
+ SilcUInt32 resolve_retry; /* Resolving retry counter */
} *SilcClientNotify;
/************************ Static utility functions **************************/
/* If entry is still invalid, resolving failed. Finish notify processing. */
if (notify->client_entry && !notify->client_entry->internal.valid) {
- silc_fsm_next(notify->fsm, silc_client_notify_processed);
+ /* If resolving timedout try it again many times. */
+ if (status != SILC_STATUS_ERR_TIMEDOUT || ++notify->resolve_retry > 1000)
+ silc_fsm_next(notify->fsm, silc_client_notify_processed);
silc_client_unref_client(client, conn, notify->client_entry);
}
SilcNotifyType type = silc_notify_get_type(payload);
SilcArgumentPayload args = silc_notify_get_args(payload);
SilcClientEntry client_entry;
+ SilcServerEntry server_entry = NULL;
SilcDList clients;
SilcID id;
int i;
if (!clients)
goto out;
+ /* Get server ID */
+ if (!silc_argument_get_decoded(args, 1, SILC_ARGUMENT_ID, &id, NULL))
+ goto out;
+
+ /* Get server, in case we have it cached */
+ server_entry = silc_client_get_server_by_id(client, conn, &id.u.server_id);
+
for (i = 1; i < silc_argument_get_arg_num(args); i++) {
/* Get Client ID */
if (!silc_argument_get_decoded(args, i + 1, SILC_ARGUMENT_ID, &id, NULL))
silc_dlist_add(clients, client_entry);
}
- /* Notify application. We don't keep server entries so the server
- entry is returned as NULL. The client's are returned as list. */
- NOTIFY(client, conn, type, NULL, clients);
+ /* Notify application. */
+ NOTIFY(client, conn, type, server_entry, clients);
/* Delete the clients */
silc_dlist_start(clients);
out:
/** Notify processed */
+ silc_client_unref_server(client, conn, server_entry);
silc_client_list_free(client, conn, clients);
silc_fsm_next(fsm, silc_client_notify_processed);
return SILC_FSM_CONTINUE;
if (!silc_argument_get_decoded(args, 2, SILC_ARGUMENT_ID, &id, NULL))
goto out;
client_entry = silc_client_get_client_by_id(client, conn, &id.u.client_id);
- if (client_entry) {
+ if (client_entry && client_entry != conn->local_entry) {
silc_client_remove_from_channels(client, conn, client_entry);
silc_client_del_client(client, conn, client_entry);
silc_client_unref_client(client, conn, client_entry);
SilcArgumentPayload args = silc_notify_get_args(payload);
SilcClientEntry client_entry = NULL;
SilcNotifyType ntype = 0;
- SilcBool del_client = FALSE;
unsigned char *pk, *tmp;
SilcUInt32 mode, pk_len, tmp_len;
SilcPublicKey public_key = NULL;
client_entry->mode = mode;
- /* If nickname was changed, remove the client entry unless the
- client is on some channel */
- /* XXX, why do we need to remove the client entry?? */
- if (tmp && ntype == SILC_NOTIFY_TYPE_NICK_CHANGE &&
- !silc_hash_table_count(client_entry->channels))
- del_client = TRUE;
- else if (ntype == SILC_NOTIFY_TYPE_SIGNOFF ||
- ntype == SILC_NOTIFY_TYPE_SERVER_SIGNOFF ||
- ntype == SILC_NOTIFY_TYPE_KILLED)
- del_client = TRUE;
-
- if (del_client) {
+ /* Remove client that left the network. */
+ if (ntype == SILC_NOTIFY_TYPE_SIGNOFF ||
+ ntype == SILC_NOTIFY_TYPE_SERVER_SIGNOFF ||
+ ntype == SILC_NOTIFY_TYPE_KILLED) {
silc_client_remove_from_channels(client, conn, client_entry);
+ client_entry->internal.valid = FALSE;
silc_client_del_client(client, conn, client_entry);
}