summaryrefslogtreecommitdiff
path: root/ext/mysqlnd/mysqlnd.c
diff options
context:
space:
mode:
authorandrey <andrey@php.net>2012-06-01 22:12:08 +0300
committerandrey <andrey@php.net>2012-06-01 22:12:08 +0300
commit2c230fb574fb2b3e17a74b6678ab36b6572a3c7a (patch)
tree2e22258661be213f0ac63679e8932460b0c3b111 /ext/mysqlnd/mysqlnd.c
parentad60e181d6829c740abc5cf0c2bd283e77484f18 (diff)
downloadphp-git-2c230fb574fb2b3e17a74b6678ab36b6572a3c7a.tar.gz
close the underlying stream as early as possible and so notify the
NET layer
Diffstat (limited to 'ext/mysqlnd/mysqlnd.c')
-rw-r--r--ext/mysqlnd/mysqlnd.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/ext/mysqlnd/mysqlnd.c b/ext/mysqlnd/mysqlnd.c
index 705dac3d45..cc3a3917a1 100644
--- a/ext/mysqlnd/mysqlnd.c
+++ b/ext/mysqlnd/mysqlnd.c
@@ -1849,8 +1849,9 @@ MYSQLND_METHOD(mysqlnd_conn_data, send_close)(MYSQLND_CONN_DATA * const conn TSR
DBG_INF("Connection clean, sending COM_QUIT");
if (net_stream) {
ret = conn->m->simple_command(conn, COM_QUIT, NULL, 0, PROT_LAST, TRUE, TRUE TSRMLS_CC);
+ net->data->m.close_stream(net, conn->stats, conn->error_info TSRMLS_CC);
}
- /* Do nothing */
+ CONN_SET_STATE(conn, CONN_QUIT_SENT);
break;
case CONN_SENDING_LOAD_DATA:
/*
@@ -1866,6 +1867,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, send_close)(MYSQLND_CONN_DATA * const conn TSR
Do nothing, the connection will be brutally closed
and the server will catch it and free close from its side.
*/
+ /* Fall-through */
case CONN_ALLOCED:
/*
Allocated but not connected or there was failure when trying
@@ -1873,16 +1875,13 @@ MYSQLND_METHOD(mysqlnd_conn_data, send_close)(MYSQLND_CONN_DATA * const conn TSR
Fall-through
*/
+ CONN_SET_STATE(conn, CONN_QUIT_SENT);
+ net->data->m.close_stream(net, conn->stats, conn->error_info TSRMLS_CC);
+ /* Fall-through */
case CONN_QUIT_SENT:
/* The user has killed its own connection */
break;
}
- /*
- We hold one reference, and every other object which needs the
- connection does increase it by 1.
- */
- CONN_SET_STATE(conn, CONN_QUIT_SENT);
- net->data->m.close_stream(net, conn->stats, conn->error_info TSRMLS_CC);
DBG_RETURN(ret);
}