summaryrefslogtreecommitdiff
path: root/vio
diff options
context:
space:
mode:
Diffstat (limited to 'vio')
-rw-r--r--[-rwxr-xr-x]vio/CMakeLists.txt0
-rw-r--r--vio/Makefile.am2
-rw-r--r--vio/vio.c4
-rw-r--r--vio/viosocket.c35
-rw-r--r--vio/viosslfactories.c16
5 files changed, 37 insertions, 20 deletions
diff --git a/vio/CMakeLists.txt b/vio/CMakeLists.txt
index e4940d54da8..e4940d54da8 100755..100644
--- a/vio/CMakeLists.txt
+++ b/vio/CMakeLists.txt
diff --git a/vio/Makefile.am b/vio/Makefile.am
index d90eb2f0e99..27596bb2fa4 100644
--- a/vio/Makefile.am
+++ b/vio/Makefile.am
@@ -22,7 +22,7 @@ noinst_HEADERS = vio_priv.h
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 84b3e26fa52..5db54d58a79 100644
--- a/vio/vio.c
+++ b/vio/vio.c
@@ -146,7 +146,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
@@ -165,7 +165,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 01abde6e0f7..d3a479edac3 100644
--- a/vio/viosocket.c
+++ b/vio/viosocket.c
@@ -32,7 +32,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);
@@ -63,7 +64,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)
{
@@ -101,7 +103,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
@@ -127,7 +130,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)
{
@@ -149,10 +152,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;
@@ -169,11 +170,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);
}
@@ -194,12 +193,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__
@@ -410,7 +409,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);
@@ -424,7 +424,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);
@@ -469,7 +470,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;
@@ -530,7 +532,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 4e3092b3b39..d26d4147c9f 100644
--- a/vio/viosslfactories.c
+++ b/vio/viosslfactories.c
@@ -234,6 +234,14 @@ new_VioSSLFd(const char *key_file, const char *cert_file,
DH *dh;
struct st_VioSSLFd *ssl_fd;
DBUG_ENTER("new_VioSSLFd");
+ DBUG_PRINT("enter",
+ ("key_file: '%s' cert_file: '%s' ca_file: '%s' ca_path: '%s' "
+ "cipher: '%s'",
+ key_file ? key_file : "NULL",
+ cert_file ? cert_file : "NULL",
+ ca_file ? ca_file : "NULL",
+ ca_path ? ca_path : "NULL",
+ cipher ? cipher : "NULL"));
check_ssl_init();
@@ -333,7 +341,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)
@@ -366,4 +374,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 */