summaryrefslogtreecommitdiff
path: root/ext/mysqlnd/mysqlnd_net.c
diff options
context:
space:
mode:
authorXinchen Hui <laruence@php.net>2011-08-24 08:00:23 +0000
committerXinchen Hui <laruence@php.net>2011-08-24 08:00:23 +0000
commit344136e8e9d2b3fea54ad7450723c524fe88ef19 (patch)
tree26a955f44fa5600eb02246985e40e11bd22a433e /ext/mysqlnd/mysqlnd_net.c
parent04b5bb7d3c5940cd665682c2e6f28b9c7f1044f0 (diff)
downloadphp-git-344136e8e9d2b3fea54ad7450723c524fe88ef19.tar.gz
Apply r315270 to 5.3
Fixed test script failed when host mysql doesn't listen on 3306 Fxied test script failed due to mysql_pconnect trigger a warning
Diffstat (limited to 'ext/mysqlnd/mysqlnd_net.c')
-rw-r--r--ext/mysqlnd/mysqlnd_net.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/ext/mysqlnd/mysqlnd_net.c b/ext/mysqlnd/mysqlnd_net.c
index 600a650804..88ce39acd0 100644
--- a/ext/mysqlnd/mysqlnd_net.c
+++ b/ext/mysqlnd/mysqlnd_net.c
@@ -120,6 +120,17 @@ MYSQLND_METHOD(mysqlnd_net, connect)(MYSQLND_NET * net, const char * const schem
net->packet_no = net->compressed_envelope_packet_no = 0;
+ if (net->stream) {
+ /* close before opening a new one */
+ DBG_INF_FMT("Freeing stream. abstract=%p", net->stream->abstract);
+ if (net->persistent) {
+ php_stream_free(net->stream, PHP_STREAM_FREE_CLOSE_PERSISTENT | PHP_STREAM_FREE_RSRC_DTOR);
+ } else {
+ php_stream_free(net->stream, PHP_STREAM_FREE_CLOSE);
+ }
+ net->stream = NULL;
+ }
+
if (net->options.timeout_connect) {
tv.tv_sec = net->options.timeout_connect;
tv.tv_usec = 0;