The silc_client_connect_to_[server|client] and
[silc.git] / lib / silcclient / command_reply.c
index ea1f74b0f2cd98e8da17d5759e04a0b2e046f366..0e952e9fff8068c9768a5d8854bc78c2ee1ba9c4 100644 (file)
@@ -195,6 +195,12 @@ SILC_FSM_STATE(silc_client_command_reply_timeout)
   SilcClientConnection conn = cmd->conn;
   SilcArgumentPayload args = NULL;
 
+  if (conn->internal->disconnected) {
+    SILC_LOG_DEBUG(("Command %s canceled", silc_get_command_name(cmd->cmd)));
+    silc_list_del(conn->internal->pending_commands, cmd);
+    return SILC_FSM_FINISH;
+  }
+
   SILC_LOG_DEBUG(("Command %s timeout", silc_get_command_name(cmd->cmd)));
 
   /* Timeout, reply not received in timely fashion */