summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/assuan-socket.c5
-rw-r--r--src/system-posix.c5
2 files changed, 7 insertions, 3 deletions
diff --git a/src/assuan-socket.c b/src/assuan-socket.c
index 6131e5b..147ec2a 100644
--- a/src/assuan-socket.c
+++ b/src/assuan-socket.c
@@ -745,6 +745,11 @@ socks5_connect (assuan_context_t ctx, assuan_fd_t sock,
ret = _assuan_connect (ctx, HANDLE2SOCKET (sock),
proxyaddr, proxyaddrlen);
}
+ /* If we get an EINPROGRESS here the caller is trying to do a
+ * non-blocking connect (e.g. for custom time out handling) which
+ * fails here. The easiest fix would be to allow the client to tell
+ * us the timeout value and we do the timeout handling later on in the
+ * Socks protocol. */
if (ret)
return ret;
buffer[0] = 5; /* RFC-1928 VER field. */
diff --git a/src/system-posix.c b/src/system-posix.c
index 52376da..65d2c8c 100644
--- a/src/system-posix.c
+++ b/src/system-posix.c
@@ -68,9 +68,8 @@ __assuan_usleep (assuan_context_t ctx, unsigned int usec)
struct timespec req;
struct timespec rem;
- req.tv_sec = 0;
- req.tv_nsec = usec * 1000;
-
+ req.tv_sec = usecs / 1000000;
+ req.tv_nsec = (usecs % 1000000) * 1000;
while (nanosleep (&req, &rem) < 0 && errno == EINTR)
req = rem;
}