Skip to content

Commit fb5776a

Browse files
committed
Fixed connect bug, thanks to lolli on IRC.
1 parent beabde7 commit fb5776a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

library.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -473,16 +473,16 @@ PHPAPI int redis_sock_connect(RedisSock *redis_sock TSRMLS_DC)
473473

474474
efree(host);
475475

476-
/* set TCP_NODELAY */
477-
php_netstream_data_t *sock = (php_netstream_data_t*)redis_sock->stream->abstract;
478-
int tcp_flag = 1;
479-
int result = setsockopt(sock->socket, IPPROTO_TCP, TCP_NODELAY, (char *) &tcp_flag, sizeof(int));
480-
481476
if (!redis_sock->stream) {
482477
efree(errstr);
483478
return -1;
484479
}
485480

481+
/* set TCP_NODELAY */
482+
php_netstream_data_t *sock = (php_netstream_data_t*)redis_sock->stream->abstract;
483+
int tcp_flag = 1;
484+
int result = setsockopt(sock->socket, IPPROTO_TCP, TCP_NODELAY, (char *) &tcp_flag, sizeof(int));
485+
486486
php_stream_auto_cleanup(redis_sock->stream);
487487

488488
if(tv.tv_sec != 0) {

0 commit comments

Comments
 (0)