/* Send the user mode notify to notify that client is detached */
client->mode |= SILC_UMODE_DETACHED;
client->data.status &= ~SILC_IDLIST_STATUS_RESUMED;
+ client->last_command = 0;
+ client->fast_command = 0;
if (!server->standalone)
silc_server_send_notify_umode(server, server->router->connection,
server->server_type == SILC_SERVER ?
#define RESUME_CALL_COMPLETION(client, session, s) \
do { \
+ SILC_LOG_DEBUG(("Calling completion")); \
session->success = s; \
silc_schedule_task_add(client->schedule, 0, \
silc_client_resume_call_completion, session, \
SilcClientResumeSession session = context;
int i;
+ SILC_LOG_DEBUG(("Session completed"));
+
for (i = 0; i < session->cmd_idents_count; i++)
silc_client_command_pending_del(session->conn, SILC_COMMAND_IDENTIFY,
session->cmd_idents[i]);
/* Allocate command reply context. This must be free'd by the
command reply routine receiving it. */
ctx = silc_calloc(1, sizeof(*ctx));
+ ctx->users++;
ctx->client = client;
ctx->sock = sock;
ctx->payload = payload;
}
}
+/* Duplicate Command Reply Context by adding reference counter. The context
+ won't be free'd untill it hits zero. */
+
+SilcClientCommandReplyContext
+silc_client_command_reply_dup(SilcClientCommandReplyContext cmd)
+{
+ cmd->users++;
+ SILC_LOG_DEBUG(("Command reply context %p refcnt %d->%d", cmd,
+ cmd->users - 1, cmd->users));
+ return cmd;
+}
+
/* Free command reply context and its internals. */
void silc_client_command_reply_free(SilcClientCommandReplyContext cmd)
{
- if (cmd) {
+ cmd->users--;
+ SILC_LOG_DEBUG(("Command reply context %p refcnt %d->%d", cmd,
+ cmd->users + 1, cmd->users));
+ if (cmd->users < 1) {
silc_command_payload_free(cmd->payload);
silc_free(cmd);
}
client_entry->fingerprint_len = fingerprint_len;
}
- if (client_entry->status & SILC_CLIENT_STATUS_RESOLVING)
- client_entry->status &= ~SILC_CLIENT_STATUS_RESOLVING;
+ client_entry->status &= ~SILC_CLIENT_STATUS_RESOLVING;
/* Notify application */
if (!cmd->callbacks_count && notify)
name, info, NULL, 0);
}
- if (client_entry->status & SILC_CLIENT_STATUS_RESOLVING)
- client_entry->status &= ~SILC_CLIENT_STATUS_RESOLVING;
+ client_entry->status &= ~SILC_CLIENT_STATUS_RESOLVING;
/* Notify application */
if (notify)
/* Check if we have this client cached already. */
client_entry = silc_client_get_client_by_id(cmd->client, conn, client_id);
if (!client_entry || !client_entry->username || !client_entry->realname) {
- if (client_entry) {
- if (client_entry->status & SILC_CLIENT_STATUS_RESOLVING) {
- /* Attach to this resolving and wait until it finishes */
- silc_client_command_pending(conn, SILC_COMMAND_NONE,
- client_entry->resolve_cmd_ident,
- get_clients, cmd);
- wait_res = TRUE;
-
- silc_buffer_pull(&client_id_list, idp_len);
- silc_buffer_pull(&client_mode_list, 4);
- continue;
- }
- client_entry->status |= SILC_CLIENT_STATUS_RESOLVING;
- client_entry->resolve_cmd_ident = conn->cmd_ident + 1;
- }
-
/* No we don't have it (or it is incomplete in information), query
it from the server. Assemble argument table that will be sent
for the WHOIS command later. */