diff options
Diffstat (limited to 'vio')
-rw-r--r-- | vio/vio.c | 58 | ||||
-rw-r--r-- | vio/viosocket.c | 10 |
2 files changed, 33 insertions, 35 deletions
diff --git a/vio/vio.c b/vio/vio.c index 689a01f4475..c47671d0e23 100644 --- a/vio/vio.c +++ b/vio/vio.c @@ -66,38 +66,40 @@ void vio_reset(Vio* vio, enum enum_vio_type type, my_socket sd, HANDLE hPipe, my_bool localhost) { - bzero((char*) vio, sizeof(Vio)); + bzero((char*) vio, sizeof(*vio)); vio->type = type; vio->sd = sd; vio->hPipe = hPipe; vio->localhost= localhost; #ifdef HAVE_VIO -if(type == VIO_TYPE_SSL){ - vio->viodelete =vio_ssl_delete; - vio->vioerrno =vio_ssl_errno; - vio->read =vio_ssl_read; - vio->write =vio_ssl_write; - vio->fastsend =vio_ssl_fastsend; - vio->viokeepalive=vio_ssl_keepalive; - vio->should_retry=vio_ssl_should_retry; - vio->vioclose =vio_ssl_close; - vio->peer_addr =vio_ssl_peer_addr; - vio->in_addr =vio_ssl_in_addr; - vio->poll_read =vio_ssl_poll_read; -} else { /* default is VIO_TYPE_TCPIP */ - vio->viodelete =vio_delete; - vio->vioerrno =vio_errno; - vio->read =vio_read; - vio->write =vio_write; - vio->fastsend =vio_fastsend; - vio->viokeepalive=vio_keepalive; - vio->should_retry=vio_should_retry; - vio->vioclose =vio_close; - vio->peer_addr =vio_peer_addr; - vio->in_addr =vio_in_addr; - vio->poll_read =vio_poll_read; -} - + if (type == VIO_TYPE_SSL) + { + vio->viodelete =vio_ssl_delete; + vio->vioerrno =vio_ssl_errno; + vio->read =vio_ssl_read; + vio->write =vio_ssl_write; + vio->fastsend =vio_ssl_fastsend; + vio->viokeepalive =vio_ssl_keepalive; + vio->should_retry =vio_ssl_should_retry; + vio->vioclose =vio_ssl_close; + vio->peer_addr =vio_ssl_peer_addr; + vio->in_addr =vio_ssl_in_addr; + vio->poll_read =vio_ssl_poll_read; + } + else /* default is VIO_TYPE_TCPIP */ + { + vio->viodelete =vio_delete; + vio->vioerrno =vio_errno; + vio->read =vio_read; + vio->write =vio_write; + vio->fastsend =vio_fastsend; + vio->viokeepalive =vio_keepalive; + vio->should_retry =vio_should_retry; + vio->vioclose =vio_close; + vio->peer_addr =vio_peer_addr; + vio->in_addr =vio_in_addr; + vio->poll_read =vio_poll_read; + } #endif /* HAVE_VIO */ } @@ -148,5 +150,3 @@ Vio *vio_new_win32pipe(HANDLE hPipe) } #endif - - diff --git a/vio/viosocket.c b/vio/viosocket.c index 16260f92596..bf151c19928 100644 --- a/vio/viosocket.c +++ b/vio/viosocket.c @@ -101,7 +101,7 @@ int vio_read(Vio * vio, gptr buf, int size) #ifndef DBUG_OFF if (r < 0) { - DBUG_PRINT("error", ("Got error %d during read",errno)); + DBUG_PRINT("vio_error", ("Got error %d during read",errno)); } #endif /* DBUG_OFF */ DBUG_PRINT("exit", ("%d", r)); @@ -129,7 +129,7 @@ int vio_write(Vio * vio, const gptr buf, int size) #ifndef DBUG_OFF if (r < 0) { - DBUG_PRINT("error", ("Got error on write: %d",errno)); + DBUG_PRINT("vio_error", ("Got error on write: %d",errno)); } #endif /* DBUG_OFF */ DBUG_PRINT("exit", ("%d", r)); @@ -268,7 +268,7 @@ int vio_close(Vio * vio) } if (r) { - DBUG_PRINT("error", ("close() failed, error: %d",errno)); + DBUG_PRINT("vio_error", ("close() failed, error: %d",errno)); /* FIXME: error handling (not critical for MySQL) */ } vio->type= VIO_CLOSED; @@ -310,8 +310,7 @@ my_bool vio_peer_addr(Vio * vio, char *buf) DBUG_PRINT("exit", ("getpeername, error: %d", errno)); DBUG_RETURN(1); } - /* FIXME */ -/* my_inet_ntoa(vio->remote.sin_addr,buf); */ + my_inet_ntoa(vio->remote.sin_addr,buf); } DBUG_PRINT("exit", ("addr=%s", buf)); DBUG_RETURN(0); @@ -349,4 +348,3 @@ my_bool vio_poll_read(Vio *vio,uint timeout) DBUG_RETURN(fds.revents & POLLIN ? 0 : 1); #endif } - |