diff options
author | Vladislav Vaintroub <vvaintroub@fedora12> | 2009-12-25 16:49:21 +0100 |
---|---|---|
committer | Vladislav Vaintroub <vvaintroub@fedora12> | 2009-12-25 16:49:21 +0100 |
commit | e8bdef8fcd05472a41d193e0f67992bfb5a3e57b (patch) | |
tree | 7759e1bcb9d4f5273bfcaada45aac3885f5cd8fe /vio | |
parent | 57e3ba292a87ef01e1c1dc35c224be0712983349 (diff) | |
parent | 85d5a08b51e24af57120068bed4534e4c1e889f4 (diff) | |
download | mariadb-git-e8bdef8fcd05472a41d193e0f67992bfb5a3e57b.tar.gz |
merge
Diffstat (limited to 'vio')
-rw-r--r-- | vio/viosocket.c | 21 |
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 |