summaryrefslogtreecommitdiff
path: root/vio
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@montyprogram.com>2012-01-24 19:18:22 +0100
committerVladislav Vaintroub <wlad@montyprogram.com>2012-01-24 19:18:22 +0100
commit398c935db30f934cd231fb5566a2bce7917a621c (patch)
treeab7ae524a0c8d44114fe2bcdb821bc6959bf853a /vio
parentd50649ecf787d4adf80544e892a00a709db37f32 (diff)
downloadmariadb-git-398c935db30f934cd231fb5566a2bce7917a621c.tar.gz
further reduce diffs to 5.5, monty review
Diffstat (limited to 'vio')
-rw-r--r--vio/vio.c2
-rw-r--r--vio/vio_priv.h1
-rw-r--r--vio/viosocket.c11
3 files changed, 8 insertions, 6 deletions
diff --git a/vio/vio.c b/vio/vio.c
index aa0d2012afa..415e3e23768 100644
--- a/vio/vio.c
+++ b/vio/vio.c
@@ -64,7 +64,7 @@ int vio_shared_memory_shutdown(Vio *vio, int how)
int vio_pipe_shutdown(Vio *vio, int how)
{
- return vio_socket_shutdown(vio, how); /* cancels io */
+ return cancel_io(vio->hPipe, vio->thread_id);
}
#endif
diff --git a/vio/vio_priv.h b/vio/vio_priv.h
index 3f62c508375..c390f8ea42e 100644
--- a/vio/vio_priv.h
+++ b/vio/vio_priv.h
@@ -39,6 +39,7 @@ size_t vio_read_pipe(Vio *vio, uchar * buf, size_t size);
size_t vio_write_pipe(Vio *vio, const uchar * buf, size_t size);
my_bool vio_is_connected_pipe(Vio *vio);
int vio_close_pipe(Vio * vio);
+int cancel_io(HANDLE handle, DWORD thread_id);
int vio_shutdown_pipe(Vio *vio,int how);
#endif
diff --git a/vio/viosocket.c b/vio/viosocket.c
index b554eec7d4f..e656d1809e4 100644
--- a/vio/viosocket.c
+++ b/vio/viosocket.c
@@ -144,7 +144,7 @@ static void CALLBACK cancel_io_apc(ULONG_PTR data)
IO. On Vista+, simpler cancelation is done with CancelIoEx.
*/
-static int cancel_io(HANDLE handle, DWORD thread_id)
+int cancel_io(HANDLE handle, DWORD thread_id)
{
static BOOL (WINAPI *fp_CancelIoEx) (HANDLE, OVERLAPPED *);
static volatile int first_time= 1;
@@ -177,11 +177,12 @@ static int cancel_io(HANDLE handle, DWORD thread_id)
int vio_socket_shutdown(Vio *vio, int how)
{
-#ifdef _WIN32
- return cancel_io((HANDLE)vio->sd, vio->thread_id);
-#else
- return shutdown(vio->sd, how);
+ int ret= shutdown(vio->sd, how);
+#ifdef _WIN32
+ /* Cancel possible IO in progress (shutdown does not do that on Windows). */
+ (void) cancel_io((HANDLE)vio->sd, vio->thread_id);
#endif
+ return ret;
}