silc-client: handle prompt abort better
[silc.git] / apps / irssi / src / silc / core / client_ops.c
index 25db9eae17f7fcce96171ca588cd9594e9a15ac7..b3b6cdbc59b2112d4eab5898dae76dd594cd28d0 100644 (file)
@@ -2487,8 +2487,8 @@ silc_verify_public_key_internal(SilcClient client, SilcClientConnection conn,
                  "server" : "client");
   int i;
 
+  server = (SILC_SERVER_REC*)conn->context;
   if (conn_type != SILC_CONN_CLIENT) {
-    server = (SILC_SERVER_REC*)conn->context;
     SILC_VERIFY(server);
     if (!server) {
       if (completion)
@@ -2497,6 +2497,12 @@ silc_verify_public_key_internal(SilcClient client, SilcClientConnection conn,
     }
   }
 
+  /* If we have pending public key prompt already up */
+  if (server && server->prompt_op) {
+    silc_async_abort(server->prompt_op, NULL, NULL);
+    server->prompt_op = NULL;
+  }
+
   if (silc_pkcs_get_type(public_key) != SILC_PKCS_SILC) {
     printformat_module("fe-common/silc", NULL, NULL,
                       MSGLEVEL_CRAP, SILCTXT_PUBKEY_UNSUPPORTED,