Added SILC Thread Queue API
[crypto.git] / lib / silcserver / server_st_accept.c
index b6e638842840f9a830b97d0bf3ea45dc56de8835..5f40be9297a1369bb444805b66ec3eecc254a7a4 100644 (file)
@@ -4,7 +4,7 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 1997 - 2005 Pekka Riikonen
+  Copyright (C) 1997 - 2006 Pekka Riikonen
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -66,7 +66,7 @@ silc_server_accept_completed(SilcSKE ske, SilcSKEStatus status,
   ac->rekey = rekey;
 
   /* Continue synchronously to take keys into use immediately */
-  SILC_FSM_CALL_CONTINUE_SYNC(ac->t);
+  SILC_FSM_CALL_CONTINUE_SYNC(&ac->t);
 }
 
 /* Authentication data callback */
@@ -129,7 +129,7 @@ silc_server_accept_auth_compl(SilcConnAuth connauth, SilcBool success,
 {
   SilcServerAccept ac = context;
   ac->auth_success = success;
-  SILC_FSM_CALL_CONTINUE(ac->t);
+  SILC_FSM_CALL_CONTINUE(&ac->t);
 }
 
 /* Free context */
@@ -146,7 +146,6 @@ void silc_server_accept_connection_dest(SilcFSM fsm, void *fsm_context,
                                        void *destructor_context)
 {
   SilcServerAccept ac = fsm_context;
-  silc_fsm_free(fsm);
   silc_server_accept_free(ac);
 }
 
@@ -348,7 +347,7 @@ SILC_FSM_STATE(silc_server_st_accept_authenticated)
     conn_number = server->stat.my_routers;
   }
 
-  silc_fsm_sema_init(&ac->wait_register, silc_fsm_get_machine(fsm), 0);
+  silc_fsm_event_init(&ac->wait_register, silc_fsm_get_machine(fsm), 0);
 
   /* Check version */
   l_protocol_version = silc_version_to_num(params && params->version_protocol ?
@@ -477,7 +476,7 @@ SILC_FSM_STATE(silc_server_st_accept_client)
   int ret;
 
   /* Wait here for the NEW_CLIENT or RESUME_CLIENT packet */
-  SILC_FSM_SEMA_TIMEDWAIT(&ac->wait_register, 20, 0, &timedout);
+  SILC_FSM_EVENT_TIMEDWAIT(&ac->wait_register, 20, 0, &timedout);
 
   if (!ac->register_packet || timedout) {
     /** Client did not register */
@@ -556,8 +555,8 @@ SILC_FSM_STATE(silc_server_st_accept_client)
   ret = silc_parse_userfqdn(username, u, 128, h, sizeof(h));
   if (ret < 2) {
     /* Hostname not present, add it */
-    snprintf(n, sizeof(n), "%s", u);
-    snprintf(u, sizeof(u) - 1, "%s@%s", n, ac->hostname);
+    silc_snprintf(n, sizeof(n), "%s", u);
+    silc_snprintf(u, sizeof(u) - 1, "%s@%s", n, ac->hostname);
   } else {
     /* Verify that hostname is same than resolved hostname */
     if (strcmp(ac->hostname, h)) {
@@ -569,8 +568,8 @@ SILC_FSM_STATE(silc_server_st_accept_client)
       silc_fsm_next(fsm, silc_server_st_accept_error);
       return SILC_FSM_CONTINUE;
     }
-    snprintf(n, sizeof(n), "%s", u);
-    snprintf(u, sizeof(u) - 1, "%s@%s", n, h);
+    silc_snprintf(n, sizeof(n), "%s", u);
+    silc_snprintf(u, sizeof(u) - 1, "%s@%s", n, h);
   }
 
   /* If configured as anonymous, scramble the username and hostname */
@@ -704,7 +703,7 @@ SILC_FSM_STATE(silc_server_st_accept_server)
 #if 0
 
   /* Wait here for the NEW_SERVER packet */
-  SILC_FSM_SEMA_TIMEDWAIT(&ac->wait_register, 20, 0, &timedout);
+  SILC_FSM_EVENT_TIMEDWAIT(&ac->wait_register, 20, 0, &timedout);
 
   if (!ac->register_packet || timedout) {
     /** Server did not register */