openbsd-ports/palm/coldsync/patches/patch-libpconn_PConnection_net_c
2005-01-17 00:25:38 +00:00

38 lines
1.2 KiB
Plaintext

$OpenBSD: patch-libpconn_PConnection_net_c,v 1.1.1.1 2005/01/17 00:25:38 jcs Exp $
--- libpconn/PConnection_net.c.orig Wed Jul 30 08:20:57 2003
+++ libpconn/PConnection_net.c Sun Jan 16 18:16:16 2005
@@ -476,6 +476,7 @@ net_accept(PConnection *p)
return -1;
cliaddr_len = sizeof(cliaddr);
+#if 0
net_udp_listen(p, &wakeup_pkt,
&cliaddr, &cliaddr_len);
/* XXX - Error-checking */
@@ -483,6 +484,7 @@ net_accept(PConnection *p)
net_acknowledge_wakeup(p, &wakeup_pkt,
&cliaddr, &cliaddr_len);
/* XXX - Error-checking */
+#endif
net_tcp_listen(p);
/* XXX - Error-checking */
@@ -738,6 +740,7 @@ static int
net_tcp_listen(PConnection *pconn)
{
int err;
+ int one = 1;
struct sockaddr_in servaddr; /* Local host's (server's) address */
struct sockaddr_in cliaddr; /* Client's address */
socklen_t cliaddr_len; /* Length of client's address */
@@ -794,6 +797,9 @@ net_tcp_listen(PConnection *pconn)
else
servaddr.sin_port = service->s_port;
/* Port is already in network byte order */
+
+ /* allow a quick restart */
+ setsockopt(pconn->fd, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one));
IO_TRACE(5)
fprintf(stderr, "binding\n");