summaryrefslogtreecommitdiff
path: root/vio/viosocket.c
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2016-09-09 08:33:08 +0200
committerSergei Golubchik <serg@mariadb.org>2016-09-09 08:33:08 +0200
commit06b7fce9f24116080168b924d17f71b979fc3a14 (patch)
tree5ff9f5684bb118abbee5a9fd3b838d0841661287 /vio/viosocket.c
parent1f2ff25eba6c089b2698cd0dab96155ccbf2afd2 (diff)
parent8494039757a2f6353cc161e7824aab4fe2312d2a (diff)
downloadmariadb-git-06b7fce9f24116080168b924d17f71b979fc3a14.tar.gz
Merge branch '10.1' into 10.2
Diffstat (limited to 'vio/viosocket.c')
-rw-r--r--vio/viosocket.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/vio/viosocket.c b/vio/viosocket.c
index a33de48c020..074948badec 100644
--- a/vio/viosocket.c
+++ b/vio/viosocket.c
@@ -190,6 +190,12 @@ size_t vio_read(Vio *vio, uchar *buf, size_t size)
{
DBUG_PRINT("vio_error", ("Got error %d during read", errno));
}
+#ifndef DEBUG_DATA_PACKETS
+ else
+ {
+ DBUG_DUMP("read_data", buf, ret);
+ }
+#endif /* DEBUG_DATA_PACKETS */
#endif /* DBUG_OFF */
DBUG_PRINT("exit", ("%d", (int) ret));
DBUG_RETURN(ret);
@@ -369,6 +375,13 @@ int vio_blocking(Vio *vio, my_bool set_blocking_mode, my_bool *old_mode)
DBUG_RETURN(r);
}
+/*
+ Check if vio is blocking
+
+ @retval 0 is not blocking
+ @retval 1 is blocking
+*/
+
my_bool
vio_is_blocking(Vio * vio)
{
@@ -523,7 +536,9 @@ int vio_keepalive(Vio* vio, my_bool set_keep_alive)
my_bool
vio_should_retry(Vio *vio)
{
- return (vio_errno(vio) == SOCKET_EINTR);
+ DBUG_ENTER("vio_should_retry");
+ DBUG_PRINT("info", ("vio_errno: %d", vio_errno(vio)));
+ DBUG_RETURN(vio_errno(vio) == SOCKET_EINTR);
}
@@ -548,8 +563,9 @@ int vio_close(Vio *vio)
{
int r=0;
DBUG_ENTER("vio_close");
+ DBUG_PRINT("enter", ("sd: %d", mysql_socket_getfd(vio->mysql_socket)));
- if (vio->type != VIO_CLOSED)
+ if (vio->type != VIO_CLOSED)
{
DBUG_ASSERT(vio->type == VIO_TYPE_TCPIP ||
vio->type == VIO_TYPE_SOCKET ||
@@ -880,6 +896,7 @@ int vio_io_wait(Vio *vio, enum enum_vio_io_event event, int timeout)
my_socket sd= mysql_socket_getfd(vio->mysql_socket);
MYSQL_SOCKET_WAIT_VARIABLES(locker, state) /* no ';' */
DBUG_ENTER("vio_io_wait");
+ DBUG_PRINT("enter", ("timeout: %d", timeout));
/*
Note that if zero timeout, then we will not block, so we do not need to
@@ -891,7 +908,10 @@ int vio_io_wait(Vio *vio, enum enum_vio_io_event event, int timeout)
PSI_SOCKET_SELECT, timeout);
ret= my_io_wait_async(vio->async_context, event, timeout);
if (ret == 0)
+ {
+ DBUG_PRINT("info", ("timeout"));
errno= SOCKET_ETIMEDOUT;
+ }
END_SOCKET_WAIT(locker,timeout);
DBUG_RETURN(ret);
}
@@ -925,6 +945,7 @@ int vio_io_wait(Vio *vio, enum enum_vio_io_event event, int timeout)
switch ((ret= poll(&pfd, 1, timeout)))
{
case -1:
+ DBUG_PRINT("error", ("poll returned -1"));
/* On error, -1 is returned. */
break;
case 0:
@@ -932,6 +953,7 @@ int vio_io_wait(Vio *vio, enum enum_vio_io_event event, int timeout)
Set errno to indicate a timeout error.
(This is not compiled in on WIN32.)
*/
+ DBUG_PRINT("info", ("poll timeout"));
errno= SOCKET_ETIMEDOUT;
break;
default: