Fixed connection authentication protocol aborting.
[silc.git] / lib / silcclient / client_connect.c
index 06f6a71378fdc3723d90da197b117ec079ba61bd..765eba24d629094210fb6a3f756465ee5b702538 100644 (file)
@@ -87,7 +87,7 @@ static void silc_client_connect_callback(SilcNetStatus status,
 
   /* Connection created successfully */
   SILC_LOG_DEBUG(("Connected"));
-  conn->stream = (void *)stream;
+  conn->internal->user_stream = stream;
   SILC_FSM_CALL_CONTINUE(fsm);
 }
 
@@ -267,6 +267,9 @@ static void silc_client_rekey_completion(SilcSKE ske,
   silc_ske_free_rekey_material(conn->internal->rekey);
   conn->internal->rekey = rekey;
 
+  silc_ske_free(conn->internal->ske);
+  conn->internal->ske = NULL;
+
   SILC_LOG_DEBUG(("Rekey completed conn %p", conn));
 
   /* Rekey done */
@@ -313,7 +316,7 @@ static void silc_client_connect_auth_completion(SilcConnAuth connauth,
     silc_fsm_next(fsm, silc_client_st_connect_error);
   }
 
-  SILC_FSM_CALL_CONTINUE(fsm);
+  SILC_FSM_CALL_CONTINUE_SYNC(fsm);
 }
 
 /********************** CONNECTION_AUTH_REQUEST packet **********************/
@@ -435,7 +438,7 @@ SILC_FSM_STATE(silc_client_st_connect_set_stream)
   /* Create packet stream */
   conn->stream = silc_packet_stream_create(client->internal->packet_engine,
                                           conn->internal->schedule,
-                                          (SilcStream)conn->stream);
+                                          conn->internal->user_stream);
   if (!conn->stream) {
     /** Cannot create packet stream */
     SILC_LOG_DEBUG(("Could not create packet stream"));
@@ -547,7 +550,7 @@ SILC_FSM_STATE(silc_client_st_connect_setup_udp)
   return SILC_FSM_CONTINUE;
 }
 
-/* Resolved authentication method to be used in authentication protocol */
+/* Resolve authentication method to be used in authentication protocol */
 
 SILC_FSM_STATE(silc_client_st_connect_auth_resolve)
 {