WIP: pth transistion, 3rd step, commands basically ported
[rxpd] / src / rxpd_socket.c
index 278261cb864f33c217dcbce62430feb9a386af7b..e8a1e9cf3efd3a444bee1a89f6d78f01d66df846 100644 (file)
@@ -110,7 +110,6 @@ rxpd_socket_join (struct rxpd_socket* self)
 struct rxpd_socket*
 rxpd_socket_spawn (struct rxpd_socket* self)
 {
-      rxpd_log (NULL, LOG_NOTICE, "socket spawn\n");
   if (self)
     {
       if (self->accepter)
@@ -131,21 +130,20 @@ rxpd_socket_accept (void* ptr)
 
   pth_event_t ev = pth_event (PTH_EVENT_FD|PTH_UNTIL_FD_READABLE, self->fd);
 
-      rxpd_log (NULL, LOG_NOTICE, "pre ACCEPT\n");
+  rxpd_log (NULL, LOG_NOTICE, "pre ACCEPT\n");
 
+  // TODO cancel thread to leave the loop?
   while (pth_wait (ev))
     {
       rxpd_log (NULL, LOG_NOTICE, "ACCEPT\n");
 
-  //  struct rxpd_connection* conn =
-      rxpd_connection_new (self);
+      struct rxpd_connection* conn =
+        rxpd_connection_new (self);
+      rxpd_connection_spawn (conn);
     }
 
   rxpd_log (NULL, LOG_NOTICE, "closed\n");
 
-  pth_event_free (ev, PTH_FREE_ALL);
-  //rxpd_connection_schedule (conn);
-  //rxpd_socket_schedule (self);
   return NULL;
 }