summaryrefslogtreecommitdiff
path: root/vio/viossl.c
diff options
context:
space:
mode:
authorunknown <jimw@mysql.com>2005-05-24 11:02:39 -0700
committerunknown <jimw@mysql.com>2005-05-24 11:02:39 -0700
commit80a226aa622c4a31a03476d5894e3671f2011bb4 (patch)
treebfe634ca784d5c7471c7c399a337336c426c674f /vio/viossl.c
parentedcc645b8e03bcd60012a871ead7175067b72c0a (diff)
downloadmariadb-git-80a226aa622c4a31a03476d5894e3671f2011bb4.tar.gz
Fix timeouts with SSL on Windows, and also sync the fastsend
implementation with normal socket behavior. (Bug #8572) vio/viossl.c: Sync implementations of *_fastsend() and *_timeout() with viosocket.c
Diffstat (limited to 'vio/viossl.c')
-rw-r--r--vio/viossl.c45
1 files changed, 28 insertions, 17 deletions
diff --git a/vio/viossl.c b/vio/viossl.c
index 773d444063b..043d23f0238 100644
--- a/vio/viossl.c
+++ b/vio/viossl.c
@@ -128,26 +128,32 @@ int vio_ssl_write(Vio * vio, const gptr buf, int size)
int vio_ssl_fastsend(Vio * vio __attribute__((unused)))
{
- int r= 0;
+ int r=0;
DBUG_ENTER("vio_ssl_fastsend");
-#ifdef IPTOS_THROUGHPUT
+#if defined(IPTOS_THROUGHPUT) && !defined(__EMX__)
{
-#ifndef __EMX__
- int tos = IPTOS_THROUGHPUT;
- if (!setsockopt(vio->sd, IPPROTO_IP, IP_TOS, (void *) &tos, sizeof(tos)))
-#endif /* !__EMX__ */
- {
- int nodelay = 1;
- if (setsockopt(vio->sd, IPPROTO_TCP, TCP_NODELAY, (void *) &nodelay,
- sizeof(nodelay))) {
- DBUG_PRINT("warning",
- ("Couldn't set socket option for fast send"));
- r= -1;
- }
- }
+ int tos= IPTOS_THROUGHPUT;
+ r= setsockopt(vio->sd, IPPROTO_IP, IP_TOS, (void *) &tos, sizeof(tos));
+ }
+#endif /* IPTOS_THROUGHPUT && !__EMX__ */
+ if (!r)
+ {
+#ifdef __WIN__
+ BOOL nodelay= 1;
+ r= setsockopt(vio->sd, IPPROTO_TCP, TCP_NODELAY, (const char*) &nodelay,
+ sizeof(nodelay));
+#else
+ int nodelay= 1;
+ r= setsockopt(vio->sd, IPPROTO_TCP, TCP_NODELAY, (void*) &nodelay,
+ sizeof(nodelay));
+#endif /* __WIN__ */
+ }
+ if (r)
+ {
+ DBUG_PRINT("warning", ("Couldn't set socket option for fast send"));
+ r= -1;
}
-#endif /* IPTOS_THROUGHPUT */
DBUG_PRINT("exit", ("%d", r));
DBUG_RETURN(r);
}
@@ -424,6 +430,11 @@ void vio_ssl_timeout(Vio *vio __attribute__((unused)),
uint which __attribute__((unused)),
uint timeout __attribute__((unused)))
{
- /* Not yet implemented (non critical) */
+#ifdef __WIN__
+ ulong wait_timeout= (ulong) timeout * 1000;
+ (void) setsockopt(vio->sd, SOL_SOCKET,
+ which ? SO_SNDTIMEO : SO_RCVTIMEO, (char*) &wait_timeout,
+ sizeof(wait_timeout));
+#endif /* __WIN__ */
}
#endif /* HAVE_OPENSSL */