summaryrefslogtreecommitdiff
path: root/vio
diff options
context:
space:
mode:
authorVladislav Vaintroub <vvaintroub@fedora12>2009-12-25 16:49:21 +0100
committerVladislav Vaintroub <vvaintroub@fedora12>2009-12-25 16:49:21 +0100
commit541edcc2e4a746908e508c6f997baf13c02aee89 (patch)
tree7759e1bcb9d4f5273bfcaada45aac3885f5cd8fe /vio
parent0940d7d2040f71686901bcc0cd708f562a9ee271 (diff)
parent6c716007d13ffd74bb5c3dd7c512d4d7026a23d8 (diff)
downloadmariadb-git-541edcc2e4a746908e508c6f997baf13c02aee89.tar.gz
merge
Diffstat (limited to 'vio')
-rw-r--r--vio/viosocket.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/vio/viosocket.c b/vio/viosocket.c
index 484eb44fe63..6c361e4a462 100644
--- a/vio/viosocket.c
+++ b/vio/viosocket.c
@@ -208,7 +208,7 @@ int vio_fastsend(Vio * vio __attribute__((unused)))
#endif
r= setsockopt(vio->sd, IPPROTO_TCP, TCP_NODELAY,
- IF_WIN(const char*, void*) &nodelay,
+ IF_WIN((const char*), (void*)) &nodelay,
sizeof(nodelay));
}
@@ -240,11 +240,20 @@ int vio_keepalive(Vio* vio, my_bool set_keep_alive)
my_bool
-vio_should_retry(Vio * vio __attribute__((unused)))
+vio_should_retry(Vio * vio)
{
int en = socket_errno;
- return (en == SOCKET_EAGAIN || en == SOCKET_EINTR ||
- en == SOCKET_EWOULDBLOCK);
+ /*
+ man 2 read write
+ EAGAIN or EWOULDBLOCK when a socket is a non-blocking mode means
+ that the read/write would block.
+ man 7 socket
+ EAGAIN or EWOULDBLOCK when a socket is in a blocking mode means
+ that the corresponding receiving or sending timeout was reached.
+ */
+ return en == SOCKET_EINTR ||
+ (!vio_is_blocking(vio) &&
+ (en == SOCKET_EAGAIN || en == SOCKET_EWOULDBLOCK));
}
@@ -682,15 +691,13 @@ void vio_timeout(Vio *vio, uint which, uint timeout)
#endif
r= setsockopt(vio->sd, SOL_SOCKET, which ? SO_SNDTIMEO : SO_RCVTIMEO,
- IF_WIN(const char*, const void*)&wait_timeout,
+ IF_WIN((const char*), (const void*))&wait_timeout,
sizeof(wait_timeout));
}
-#ifndef DBUG_OFF
if (r != 0)
DBUG_PRINT("error", ("setsockopt failed: %d, errno: %d", r, socket_errno));
-#endif
DBUG_VOID_RETURN;
#else