Added SILC Thread Queue API
[silc.git] / lib / silcutil / tests / test_silcfdstream.c
index c0039b1ce5f73d72deef4b6035e42bc5751f06b4..dfc231733b92040517a864e970f4f1dac5c205b6 100644 (file)
@@ -32,7 +32,7 @@ SILC_FSM_STATE(st_end)
 {
   unlink("/tmp/test_silcfdstream");
   unlink("/tmp/test_silcfdstream_copy");
-  SILC_FSM_FINISH;
+  return SILC_FSM_FINISH;
 }
 
 SILC_FSM_STATE(st_readwrite)
@@ -58,7 +58,7 @@ SILC_FSM_STATE(st_readwrite)
   }
 
   SILC_LOG_DEBUG(("Creating FD stream (two fds)"));
-  stream = silc_fd_stream_create2(fd1, fd2);
+  stream = silc_fd_stream_create2(fd1, fd2, NULL);
   if (!stream) {
     SILC_LOG_DEBUG(("Error creating stream"));
     goto err;
@@ -83,7 +83,7 @@ SILC_FSM_STATE(st_readwrite)
       if (i == -1) {
         SILC_LOG_DEBUG(("Would block, write later"));
         silc_fsm_next(fsm, st_end);
-        SILC_FSM_WAIT;
+        return SILC_FSM_WAIT;
       }
 
       if (i == -2) {
@@ -99,7 +99,7 @@ SILC_FSM_STATE(st_readwrite)
   if (ret == -1) {
     SILC_LOG_DEBUG(("Would block, read later"));
     silc_fsm_next(fsm, st_end);
-    SILC_FSM_WAIT;
+    return SILC_FSM_WAIT;
   }
 
   if (ret == -2) {
@@ -117,11 +117,11 @@ SILC_FSM_STATE(st_readwrite)
   }
 
   silc_fsm_next(fsm, st_end);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 
  err:
   silc_fsm_next(fsm, st_end);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 SILC_FSM_STATE(st_write)
@@ -133,7 +133,7 @@ SILC_FSM_STATE(st_write)
   SILC_LOG_DEBUG(("Open file /tmp/test_silcfdstream for writing"));
   SILC_LOG_DEBUG(("Creating FD stream"));
   unlink("/tmp/test_silcfdstream");
-  stream = silc_fd_stream_file("/tmp/test_silcfdstream", FALSE, TRUE);
+  stream = silc_fd_stream_file("/tmp/test_silcfdstream", FALSE, TRUE, NULL);
   if (!stream) {
     SILC_LOG_DEBUG(("Error creating stream"));
     goto err;
@@ -159,7 +159,7 @@ SILC_FSM_STATE(st_write)
     if (ret == -1) {
       SILC_LOG_DEBUG(("Would block, write later"));
       silc_fsm_next(fsm, st_readwrite);
-      SILC_FSM_WAIT;
+      return SILC_FSM_WAIT;
     }
 
     if (ret == -2) {
@@ -179,11 +179,11 @@ SILC_FSM_STATE(st_write)
 
   SILC_LOG_DEBUG(("Continue to next state"));
   silc_fsm_next(fsm, st_readwrite);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 
  err:
   silc_fsm_next(fsm, st_end);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 static void fsm_dest(SilcFSM fsm, void *fsm_context, void *context)
@@ -199,11 +199,11 @@ int main(int argc, char **argv)
   if (argc > 1 && !strcmp(argv[1], "-d")) {
     silc_log_debug(TRUE);
     silc_log_debug_hexdump(TRUE);
-    silc_log_set_debug_string("*fdstream*");
+    silc_log_set_debug_string("*fdstream*,*errno*");
   }
 
   SILC_LOG_DEBUG(("Allocating scheduler"));
-  schedule = silc_schedule_init(0, NULL);
+  schedule = silc_schedule_init(0, NULL, NULL);
   if (!schedule)
     goto err;