Skip to content

Commit b7798fc

Browse files
committed
Persistent connections are persistent now. closes gh-73
1 parent 61b9d7b commit b7798fc

File tree

4 files changed

+22
-19
lines changed

4 files changed

+22
-19
lines changed

src/tarantool.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,9 @@ tarantool_stream_read(tarantool_object *obj, char *buf, size_t size) {
126126

127127
static void
128128
tarantool_stream_close(tarantool_object *obj) {
129-
if (obj->stream || obj->persistent_id)
129+
if (obj->stream || obj->persistent_id) {
130130
tntll_stream_close(obj->stream, obj->persistent_id);
131+
}
131132
obj->stream = NULL;
132133
obj->persistent_id = NULL;
133134
}
@@ -145,6 +146,7 @@ int __tarantool_connect(tarantool_object *obj, zval *id TSRMLS_DC) {
145146
int rv = tntll_stream_fpid(obj->host, obj->port,
146147
obj->persistent_id, &obj->stream,
147148
&err);
149+
148150
if (obj->stream == NULL)
149151
goto retry;
150152
return status;
@@ -195,8 +197,9 @@ int __tarantool_reconnect(tarantool_object *obj, zval *id TSRMLS_DC) {
195197
}
196198

197199
static void tarantool_free(tarantool_object *obj TSRMLS_DC) {
198-
int store = TARANTOOL_G(manager) && !obj->stream;
199-
if (!obj) return;
200+
if (!obj)
201+
return;
202+
int store = TARANTOOL_G(manager) && obj->stream;
200203
if (store) {
201204
pool_manager_push_assure(TARANTOOL_G(manager), obj);
202205
} else {
@@ -657,7 +660,7 @@ PHP_MINIT_FUNCTION(tarantool) {
657660

658661
/* Init global variables */
659662
TARANTOOL_G(manager) = pool_manager_create(
660-
INI_BOOL("tarantool.persistent"),
663+
INI_INT("tarantool.persistent"),
661664
INI_INT("tarantool.con_per_host")
662665
);
663666

test/shared/tarantool-1.ini

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
extension = ./tarantool.so
33

44
[tarantool]
5-
timeout = 10
6-
request_timeout = 10
7-
con_per_host = 5
8-
persistent = 1
9-
retry_count = 10
5+
tarantool.timeout = 10
6+
tarantool.request_timeout = 10
7+
tarantool.con_per_host = 5
8+
tarantool.persistent = 1
9+
tarantool.retry_count = 10
1010

1111
[xdebug]
1212
remote_autostart = 0

test/shared/tarantool-2.ini

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
extension = ./tarantool.so
33

44
[tarantool]
5-
timeout = 10
6-
request_timeout = 10
7-
con_per_host = 5
8-
persistent = 0
9-
retry_count = 10
5+
tarantool.timeout = 10
6+
tarantool.request_timeout = 10
7+
tarantool.con_per_host = 5
8+
tarantool.persistent = 0
9+
tarantool.retry_count = 10
1010

1111
[xdebug]
1212
remote_autostart = 0

test/shared/tarantool-3.ini

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
extension = ./tarantool.so
33

44
[tarantool]
5-
timeout = 10
6-
request_timeout = 10
7-
con_per_host = 1
8-
persistent = 1
9-
retry_count = 1
5+
tarantool.timeout = 10
6+
tarantool.request_timeout = 10
7+
tarantool.con_per_host = 1
8+
tarantool.persistent = 1
9+
tarantool.retry_count = 1
1010

1111
[xdebug]
1212
remote_autostart = 0

0 commit comments

Comments
 (0)