diff options
author | unknown <wax@kishkin.ru> | 2004-12-23 16:04:40 +0500 |
---|---|---|
committer | unknown <wax@kishkin.ru> | 2004-12-23 16:04:40 +0500 |
commit | a627ffb9be6998793ab2cb005447d302c00c6651 (patch) | |
tree | d0a5713515293ae6045d3043f7f05aeafdad20c4 /vio | |
parent | 615d31d0deb5c5078136741d26e5fb66baeac6a4 (diff) | |
download | mariadb-git-a627ffb9be6998793ab2cb005447d302c00c6651.tar.gz |
fix indentation
add space after comma
add space after equal
add comments in vio_close_shared_memory()
include/violite.h:
fix indentation
sql-common/client.c:
fix identation
sql/mysqld.cc:
add space after comma
vio/vio.c:
add space after equal
fix identation
vio/viosocket.c:
add space after comma
add comments in vio_close_shared_memory()
Diffstat (limited to 'vio')
-rw-r--r-- | vio/vio.c | 22 | ||||
-rw-r--r-- | vio/viosocket.c | 19 |
2 files changed, 25 insertions, 16 deletions
diff --git a/vio/vio.c b/vio/vio.c index 92d69dc5148..978780d2632 100644 --- a/vio/vio.c +++ b/vio/vio.c @@ -172,23 +172,23 @@ Vio *vio_new_win32pipe(HANDLE hPipe) Vio *vio_new_win32shared_memory(NET *net,HANDLE handle_file_map, HANDLE handle_map, HANDLE event_server_wrote, HANDLE event_server_read, HANDLE event_client_wrote, HANDLE event_client_read, - HANDLE event_conn_closed) + HANDLE event_conn_closed) { Vio *vio; DBUG_ENTER("vio_new_win32shared_memory"); if ((vio = (Vio*) my_malloc(sizeof(Vio),MYF(MY_WME)))) { vio_reset(vio, VIO_TYPE_SHARED_MEMORY, 0, 0, TRUE); - vio->handle_file_map = handle_file_map; - vio->handle_map = handle_map; - vio->event_server_wrote = event_server_wrote; - vio->event_server_read = event_server_read; - vio->event_client_wrote = event_client_wrote; - vio->event_client_read = event_client_read; - vio->event_conn_closed = event_conn_closed; - vio->shared_memory_remain = 0; - vio->shared_memory_pos = handle_map; - vio->net = net; + vio->handle_file_map= handle_file_map; + vio->handle_map= handle_map; + vio->event_server_wrote= event_server_wrote; + vio->event_server_read= event_server_read; + vio->event_client_wrote= event_client_wrote; + vio->event_client_read= event_client_read; + vio->event_conn_closed= event_conn_closed; + vio->shared_memory_remain= 0; + vio->shared_memory_pos= handle_map; + vio->net= net; strmov(vio->desc, "shared memory"); } DBUG_RETURN(vio); diff --git a/vio/viosocket.c b/vio/viosocket.c index caf9451df7a..bcba05beef1 100644 --- a/vio/viosocket.c +++ b/vio/viosocket.c @@ -390,7 +390,7 @@ int vio_read_shared_memory(Vio * vio, gptr buf, int size) WAIT_OBJECT_0+1 - event from vio->event_conn_closed. We can't read anything WAIT_ABANDONED_0 and WAIT_TIMEOUT - fail. We can't read anything */ - if (WaitForMultipleObjects(2,(HANDLE*)&events,FALSE, + if (WaitForMultipleObjects(2, (HANDLE*)&events,FALSE, vio->net->read_timeout*1000) != WAIT_OBJECT_0) { DBUG_RETURN(-1); @@ -440,7 +440,8 @@ int vio_write_shared_memory(Vio * vio, const gptr buf, int size) current_postion = buf; while (remain != 0) { - if (WaitForSingleObject(vio->event_server_read,vio->net->write_timeout*1000) != WAIT_OBJECT_0) + if (WaitForSingleObject(vio->event_server_read, vio->net->write_timeout*1000) + != WAIT_OBJECT_0) { DBUG_RETURN(-1); }; @@ -467,10 +468,18 @@ int vio_close_shared_memory(Vio * vio) DBUG_ENTER("vio_close_shared_memory"); if (vio->type != VIO_CLOSED) { + /* + Set event_conn_closed for notification of both client and server that + connection is closed + */ SetEvent(vio->event_conn_closed); - r=UnmapViewOfFile(vio->handle_map) || CloseHandle(vio->event_server_wrote) || - CloseHandle(vio->event_server_read) || CloseHandle(vio->event_client_wrote) || - CloseHandle(vio->event_client_read) || CloseHandle(vio->handle_file_map); + /* + Close all handlers. UnmapViewOfFile and CloseHandle return non-zero + result if they are success. + */ + r= UnmapViewOfFile(vio->handle_map) || CloseHandle(vio->event_server_wrote) || + CloseHandle(vio->event_server_read) || CloseHandle(vio->event_client_wrote) || + CloseHandle(vio->event_client_read) || CloseHandle(vio->handle_file_map); if (!r) { DBUG_PRINT("vio_error", ("close() failed, error: %d",r)); |