#include "ttt-socket.h"
-#include <netinet/ip.h>
+#include <netinet/in.h>
#include <netdb.h>
/* Initialize a TCP/IP address structure with the given host and port.
/* Exported: see ttt-socket.h for documentation. */
void
-ttt_socket_accept (int listen_socket, ttt_socket_dispatch_func_t dispatch)
+ttt_socket_accept (int listen_socket,
+ ttt_socket_accept_func_t accept,
+ void *closure)
{
+ pid_t pid;
int connected_socket;
connected_socket = _wait_for_connection (listen_socket);
- (dispatch) (connected_socket);
+ pid = xfork();
+
+ if (pid == 0) {
+ /* Child process. */
+ (accept) (closure, connected_socket);
+ return;
+ }
}