summaryrefslogtreecommitdiff
path: root/vio/viosocket.c
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/viosocket.c
parentd50649ecf787d4adf80544e892a00a709db37f32 (diff)
downloadmariadb-git-398c935db30f934cd231fb5566a2bce7917a621c.tar.gz
further reduce diffs to 5.5, monty review
Diffstat (limited to 'vio/viosocket.c')
-rw-r--r--vio/viosocket.c11
1 files changed, 6 insertions, 5 deletions
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;
}