diff options
Diffstat (limited to 'vio')
-rw-r--r--[-rwxr-xr-x] | vio/CMakeLists.txt | 0 | ||||
-rw-r--r-- | vio/Makefile.am | 3 | ||||
-rw-r--r-- | vio/vio.c | 4 | ||||
-rw-r--r-- | vio/viosocket.c | 35 | ||||
-rw-r--r-- | vio/viosslfactories.c | 8 |
5 files changed, 30 insertions, 20 deletions
diff --git a/vio/CMakeLists.txt b/vio/CMakeLists.txt index a3cbb304289..a3cbb304289 100755..100644 --- a/vio/CMakeLists.txt +++ b/vio/CMakeLists.txt diff --git a/vio/Makefile.am b/vio/Makefile.am index cb70501046e..b57f2453f41 100644 --- a/vio/Makefile.am +++ b/vio/Makefile.am @@ -38,6 +38,7 @@ test_sslclient_LDADD= @CLIENT_EXTRA_LDFLAGS@ ../dbug/libdbug.a libvio.a \ ../mysys/libmysys.a ../strings/libmystrings.a \ $(openssl_libs) $(yassl_libs) libvio_a_SOURCES= vio.c viosocket.c viossl.c viosslfactories.c -EXTRA_DIST= CMakeLists.txt +EXTRA_DIST= CMakeLists.txt + # Don't update the files from bitkeeper %::SCCS/s.% diff --git a/vio/vio.c b/vio/vio.c index 2b0a7f0d79b..f20acb249ef 100644 --- a/vio/vio.c +++ b/vio/vio.c @@ -147,7 +147,7 @@ Vio *vio_new(my_socket sd, enum enum_vio_type type, uint flags) sprintf(vio->desc, (vio->type == VIO_TYPE_SOCKET ? "socket (%d)" : "TCP/IP (%d)"), vio->sd); -#if !defined(__WIN__) && !defined(__EMX__) && !defined(OS2) +#if !defined(__WIN__) #if !defined(NO_FCNTL_NONBLOCK) /* We call fcntl() to set the flags and then immediately read them back @@ -166,7 +166,7 @@ Vio *vio_new(my_socket sd, enum enum_vio_type type, uint flags) (void) ioctl(sd,FIOSNBIO,0); vio->fcntl_mode &= ~O_NONBLOCK; #endif -#else /* !defined(__WIN__) && !defined(__EMX__) */ +#else /* !defined(__WIN__) */ { /* set to blocking mode by default */ ulong arg=0, r; diff --git a/vio/viosocket.c b/vio/viosocket.c index cae0cf70db4..34ef6159a86 100644 --- a/vio/viosocket.c +++ b/vio/viosocket.c @@ -33,7 +33,8 @@ int vio_read(Vio * vio, gptr buf, int size) { int r; DBUG_ENTER("vio_read"); - DBUG_PRINT("enter", ("sd: %d buf: 0x%lx size: %d", vio->sd, (long) buf, size)); + DBUG_PRINT("enter", ("sd: %d buf: 0x%lx size: %d", vio->sd, (long) buf, + size)); /* Ensure nobody uses vio_read_buff and vio_read simultaneously */ DBUG_ASSERT(vio->read_end == vio->read_pos); @@ -64,7 +65,8 @@ int vio_read_buff(Vio *vio, gptr buf, int size) int rc; #define VIO_UNBUFFERED_READ_MIN_SIZE 2048 DBUG_ENTER("vio_read_buff"); - DBUG_PRINT("enter", ("sd: %d buf: 0x%lx size: %d", vio->sd, (long) buf, size)); + DBUG_PRINT("enter", ("sd: %d buf: 0x%lx size: %d", vio->sd, (long) buf, + size)); if (vio->read_pos < vio->read_end) { @@ -102,7 +104,8 @@ int vio_write(Vio * vio, const gptr buf, int size) { int r; DBUG_ENTER("vio_write"); - DBUG_PRINT("enter", ("sd: %d buf: 0x%lx size: %d", vio->sd, (long) buf, size)); + DBUG_PRINT("enter", ("sd: %d buf: 0x%lx size: %d", vio->sd, (long) buf, + size)); #ifdef __WIN__ r = send(vio->sd, buf, size,0); #else @@ -128,7 +131,7 @@ int vio_blocking(Vio * vio __attribute__((unused)), my_bool set_blocking_mode, DBUG_PRINT("enter", ("set_blocking_mode: %d old_mode: %d", (int) set_blocking_mode, (int) *old_mode)); -#if !defined(__WIN__) && !defined(__EMX__) +#if !defined(__WIN__) #if !defined(NO_FCNTL_NONBLOCK) if (vio->sd >= 0) { @@ -150,10 +153,8 @@ int vio_blocking(Vio * vio __attribute__((unused)), my_bool set_blocking_mode, #else r= set_blocking_mode ? 0 : 1; #endif /* !defined(NO_FCNTL_NONBLOCK) */ -#else /* !defined(__WIN__) && !defined(__EMX__) */ -#ifndef __EMX__ +#else /* !defined(__WIN__) */ if (vio->type != VIO_TYPE_NAMEDPIPE && vio->type != VIO_TYPE_SHARED_MEMORY) -#endif { ulong arg; int old_fcntl=vio->fcntl_mode; @@ -170,11 +171,9 @@ int vio_blocking(Vio * vio __attribute__((unused)), my_bool set_blocking_mode, if (old_fcntl != vio->fcntl_mode) r = ioctlsocket(vio->sd,FIONBIO,(void*) &arg); } -#ifndef __EMX__ else r= test(!(vio->fcntl_mode & O_NONBLOCK)) != set_blocking_mode; -#endif /* __EMX__ */ -#endif /* !defined(__WIN__) && !defined(__EMX__) */ +#endif /* !defined(__WIN__) */ DBUG_PRINT("exit", ("%d", r)); DBUG_RETURN(r); } @@ -195,12 +194,12 @@ int vio_fastsend(Vio * vio __attribute__((unused))) int r=0; DBUG_ENTER("vio_fastsend"); -#if defined(IPTOS_THROUGHPUT) && !defined(__EMX__) +#if defined(IPTOS_THROUGHPUT) { int tos = IPTOS_THROUGHPUT; r= setsockopt(vio->sd, IPPROTO_IP, IP_TOS, (void *) &tos, sizeof(tos)); } -#endif /* IPTOS_THROUGHPUT && !__EMX__ */ +#endif /* IPTOS_THROUGHPUT */ if (!r) { #ifdef __WIN__ @@ -411,7 +410,8 @@ int vio_read_pipe(Vio * vio, gptr buf, int size) { DWORD length; DBUG_ENTER("vio_read_pipe"); - DBUG_PRINT("enter", ("sd: %d buf: 0x%lx size: %d", vio->sd, buf, size)); + DBUG_PRINT("enter", ("sd: %d buf: 0x%lx size: %d", vio->sd, (long) buf, + size)); if (!ReadFile(vio->hPipe, buf, size, &length, NULL)) DBUG_RETURN(-1); @@ -425,7 +425,8 @@ int vio_write_pipe(Vio * vio, const gptr buf, int size) { DWORD length; DBUG_ENTER("vio_write_pipe"); - DBUG_PRINT("enter", ("sd: %d buf: 0x%lx size: %d", vio->sd, buf, size)); + DBUG_PRINT("enter", ("sd: %d buf: 0x%lx size: %d", vio->sd, (long) buf, + size)); if (!WriteFile(vio->hPipe, (char*) buf, size, &length, NULL)) DBUG_RETURN(-1); @@ -470,7 +471,8 @@ int vio_read_shared_memory(Vio * vio, gptr buf, int size) char *current_postion; DBUG_ENTER("vio_read_shared_memory"); - DBUG_PRINT("enter", ("sd: %d buf: 0x%lx size: %d", vio->sd, buf, size)); + DBUG_PRINT("enter", ("sd: %d buf: 0x%lx size: %d", vio->sd, (long) buf, + size)); remain_local = size; current_postion=buf; @@ -531,7 +533,8 @@ int vio_write_shared_memory(Vio * vio, const gptr buf, int size) char *current_postion; DBUG_ENTER("vio_write_shared_memory"); - DBUG_PRINT("enter", ("sd: %d buf: 0x%lx size: %d", vio->sd, buf, size)); + DBUG_PRINT("enter", ("sd: %d buf: 0x%lx size: %d", vio->sd, (long) buf, + size)); remain = size; current_postion = buf; diff --git a/vio/viosslfactories.c b/vio/viosslfactories.c index 014ce25d754..7bb2258532f 100644 --- a/vio/viosslfactories.c +++ b/vio/viosslfactories.c @@ -316,7 +316,7 @@ new_VioSSLConnectorFd(const char *key_file, const char *cert_file, /************************ VioSSLAcceptorFd **********************************/ -struct st_VioSSLFd* +struct st_VioSSLFd * new_VioSSLAcceptorFd(const char *key_file, const char *cert_file, const char *ca_file, const char *ca_path, const char *cipher) @@ -349,4 +349,10 @@ new_VioSSLAcceptorFd(const char *key_file, const char *cert_file, return ssl_fd; } + +void free_vio_ssl_acceptor_fd(struct st_VioSSLFd *fd) +{ + SSL_CTX_free(fd->ssl_context); + my_free((gptr) fd, MYF(0)); +} #endif /* HAVE_OPENSSL */ |