Commit e2875620 authored by kroki/tomash@moonlight.intranet's avatar kroki/tomash@moonlight.intranet

Merge moonlight.intranet:/home/tomash/src/mysql_ab/mysql-4.1

into  moonlight.intranet:/home/tomash/src/mysql_ab/mysql-4.1-bug9678
parents a55d18e7 c746c08a
...@@ -747,7 +747,7 @@ my_real_read(NET *net, ulong *complen) ...@@ -747,7 +747,7 @@ my_real_read(NET *net, ulong *complen)
#endif /* EXTRA_DEBUG */ #endif /* EXTRA_DEBUG */
} }
#if defined(THREAD_SAFE_CLIENT) && !defined(MYSQL_SERVER) #if defined(THREAD_SAFE_CLIENT) && !defined(MYSQL_SERVER)
if (vio_should_retry(net->vio)) if (vio_errno(net->vio) == SOCKET_EINTR)
{ {
DBUG_PRINT("warning",("Interrupted read. Retrying...")); DBUG_PRINT("warning",("Interrupted read. Retrying..."));
continue; continue;
......
...@@ -333,16 +333,30 @@ my_bool vio_poll_read(Vio *vio,uint timeout) ...@@ -333,16 +333,30 @@ my_bool vio_poll_read(Vio *vio,uint timeout)
} }
void vio_timeout(Vio *vio __attribute__((unused)), void vio_timeout(Vio *vio, uint which, uint timeout)
uint which __attribute__((unused)),
uint timeout __attribute__((unused)))
{ {
/* TODO: some action should be taken if socket timeouts are not supported. */
#if defined(SO_SNDTIMEO) && defined(SO_RCVTIMEO)
#ifdef __WIN__ #ifdef __WIN__
ulong wait_timeout= (ulong) timeout * 1000;
(void) setsockopt(vio->sd, SOL_SOCKET, /* Windows expects time in milliseconds as int. */
which ? SO_SNDTIMEO : SO_RCVTIMEO, (char*) &wait_timeout, int wait_timeout= (int) timeout * 1000;
sizeof(wait_timeout));
#endif /* __WIN__ */ #else /* ! __WIN__ */
/* POSIX specifies time as struct timeval. */
struct timeval wait_timeout;
wait_timeout.tv_sec= timeout;
wait_timeout.tv_usec= 0;
#endif /* ! __WIN__ */
/* TODO: return value should be checked. */
(void) setsockopt(vio->sd, SOL_SOCKET, which ? SO_SNDTIMEO : SO_RCVTIMEO,
(char*) &wait_timeout, sizeof(wait_timeout));
#endif /* defined(SO_SNDTIMEO) && defined(SO_RCVTIMEO) */
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment