diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2020-08-10 21:38:55 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2020-08-10 21:38:55 +0300 |
commit | 1c587481966abc7a9ad5309d0a91ca920f7a5657 (patch) | |
tree | 28b936bd807cab0ba7b82e4cc9ec963fa6de6307 /vio | |
parent | 17be2b47ba32535e69e28da9a444e528ba8ab155 (diff) | |
parent | eae968f62d285de97ed607c87bc131cd863d5d03 (diff) | |
download | mariadb-git-1c587481966abc7a9ad5309d0a91ca920f7a5657.tar.gz |
Merge 10.4 into 10.5
Diffstat (limited to 'vio')
-rw-r--r-- | vio/vio.c | 1 | ||||
-rw-r--r-- | vio/viopipe.c | 16 |
2 files changed, 14 insertions, 3 deletions
diff --git a/vio/vio.c b/vio/vio.c index cabed39d94f..7a98eb2af7b 100644 --- a/vio/vio.c +++ b/vio/vio.c @@ -78,6 +78,7 @@ static my_bool has_no_data(Vio *vio __attribute__((unused))) #ifdef _WIN32 int vio_pipe_shutdown(Vio *vio, int how) { + vio->shutdown_flag= how; return CancelIoEx(vio->hPipe, NULL); } #endif diff --git a/vio/viopipe.c b/vio/viopipe.c index 567884807fe..aeaad311b7e 100644 --- a/vio/viopipe.c +++ b/vio/viopipe.c @@ -75,6 +75,9 @@ size_t vio_read_pipe(Vio *vio, uchar *buf, size_t count) size_t ret= (size_t) -1; DBUG_ENTER("vio_read_pipe"); + if (vio->shutdown_flag) + return ret; + disable_iocp_notification(&vio->overlapped); /* Attempt to read from the pipe (overlapped I/O). */ @@ -85,8 +88,11 @@ size_t vio_read_pipe(Vio *vio, uchar *buf, size_t count) } /* Read operation is pending completion asynchronously? */ else if (GetLastError() == ERROR_IO_PENDING) + { + if (vio->shutdown_flag) + CancelIo(vio->hPipe); ret= wait_overlapped_result(vio, vio->read_timeout); - + } enable_iocp_notification(&vio->overlapped); DBUG_RETURN(ret); @@ -99,6 +105,8 @@ size_t vio_write_pipe(Vio *vio, const uchar *buf, size_t count) size_t ret= (size_t) -1; DBUG_ENTER("vio_write_pipe"); + if (vio->shutdown_flag == SHUT_RDWR) + return ret; disable_iocp_notification(&vio->overlapped); /* Attempt to write to the pipe (overlapped I/O). */ if (WriteFile(vio->hPipe, buf, (DWORD)count, &transferred, &vio->overlapped)) @@ -108,8 +116,11 @@ size_t vio_write_pipe(Vio *vio, const uchar *buf, size_t count) } /* Write operation is pending completion asynchronously? */ else if (GetLastError() == ERROR_IO_PENDING) + { + if (vio->shutdown_flag == SHUT_RDWR) + CancelIo(vio->hPipe); ret= wait_overlapped_result(vio, vio->write_timeout); - + } enable_iocp_notification(&vio->overlapped); DBUG_RETURN(ret); } @@ -129,7 +140,6 @@ int vio_close_pipe(Vio *vio) BOOL ret; DBUG_ENTER("vio_close_pipe"); - CancelIo(vio->hPipe); CloseHandle(vio->overlapped.hEvent); ret= CloseHandle(vio->hPipe); |