aboutsummaryrefslogtreecommitdiff
path: root/src/or/connection.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2003-08-14 17:13:52 +0000
committerNick Mathewson <nickm@torproject.org>2003-08-14 17:13:52 +0000
commitcd3467bb01cb5bd98b2978fb50bdaa2f3227c980 (patch)
treed91d3689a009c3fa358bae94e883240e83fcb642 /src/or/connection.c
parent88edae94076cc39d40a39f80b2d6ddadc88fe324 (diff)
downloadtor-cd3467bb01cb5bd98b2978fb50bdaa2f3227c980.tar.gz
tor-cd3467bb01cb5bd98b2978fb50bdaa2f3227c980.zip
Attempt to make sockets code work right on windows.
svn:r398
Diffstat (limited to 'src/or/connection.c')
-rw-r--r--src/or/connection.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/or/connection.c b/src/or/connection.c
index c75b4b3793..78bf0dca55 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -188,11 +188,21 @@ int connection_handle_listener_read(connection_t *conn, int new_type, int new_st
connection_t *newconn;
struct sockaddr_in remote; /* information about the remote peer when connecting to other routers */
int remotelen = sizeof(struct sockaddr_in); /* length of the remote address */
+#ifdef MS_WINDOWS
+ int e;
+#endif
news = accept(conn->s,(struct sockaddr *)&remote,&remotelen);
if (news == -1) { /* accept() error */
- if(errno==EAGAIN)
+ if(ERRNO_EAGAIN(errno)) {
+#ifdef MS_WINDOWS
+ e = correct_socket_errno(conn->s);
+ if (ERRNO_EAGAIN(e))
+ return 0;
+#else
return 0; /* he hung up before we could accept(). that's fine. */
+#endif
+ }
/* else there was a real error. */
log_fn(LOG_ERR,"accept() failed. Closing.");
return -1;