Skip to content

Commit 98d44af

Browse files
committed
Bugfixes in redis_session.c
1 parent a35396e commit 98d44af

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

redis_session.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ redis_pool_get_sock(redis_pool *pool, const char *key TSRMLS_DC) {
106106
return rpm->redis_sock;
107107
}
108108
i += rpm->weight;
109+
rpm = rpm->next;
109110
}
110111

111112
return NULL;
@@ -133,7 +134,8 @@ PS_OPEN_FUNC(redis)
133134
j++;
134135

135136
if (i < j) {
136-
int weight = 1, timeout = 86400;
137+
int weight = 1;
138+
double timeout = 86400.0;
137139

138140
/* unix: isn't supported yet. */
139141
if (!strncmp(save_path+i, "unix:", sizeof("unix:")-1)) {
@@ -173,8 +175,7 @@ PS_OPEN_FUNC(redis)
173175
}
174176

175177
if (zend_hash_find(Z_ARRVAL_P(params), "timeout", sizeof("timeout"), (void **) &param) != FAILURE) {
176-
convert_to_long_ex(param);
177-
timeout = Z_LVAL_PP(param);
178+
timeout = atof(Z_STRVAL_PP(param));
178179
}
179180

180181
/* // not supported yet
@@ -287,7 +288,7 @@ PS_WRITE_FUNC(redis)
287288

288289
/* send SET command */
289290
session = redis_session_key(key, strlen(key), &session_len);
290-
cmd_len = redis_cmd_format_static(&cmd, "SET", "ss", session, session_len, val, vallen);
291+
cmd_len = redis_cmd_format_static(&cmd, "SETEX", "sds", session, session_len, INI_INT("session.gc_maxlifetime"), val, vallen);
291292
efree(session);
292293
if(redis_sock_write(redis_sock, cmd, cmd_len) < 0) {
293294
efree(cmd);

0 commit comments

Comments
 (0)