Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 12769b0

Browse files
author
Simon Effenberg
committed
fix for problem when setting socket timeout lower then 1 (also the microsecond part wasn't used because of the bug)
1 parent 9ab35fa commit 12769b0

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

debian/changelog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
phpredis (2.0.10-1) unstable; urgency=low
2+
3+
* Fixed wrong timeout option when setting timeout to lower then 1s.
4+
5+
-- Simon Effenberg <[email protected]> Mon, 08 Nov 2010 12:30:54 +0100
6+
17
phpredis (2.0.10) unstable; urgency=low
28

39
* Merged with upstream

library.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -706,11 +706,11 @@ PHPAPI int redis_sock_connect(RedisSock *redis_sock TSRMLS_DC)
706706
}
707707

708708
tv.tv_sec = (time_t)redis_sock->timeout;
709-
tv.tv_usec = ((int)(redis_sock->timeout - tv.tv_sec)) * 1000000;
709+
tv.tv_usec = (int)((redis_sock->timeout - tv.tv_sec) * 1000000);
710710

711711
host_len = spprintf(&host, 0, "%s:%d", redis_sock->host, redis_sock->port);
712712

713-
if(tv.tv_sec != 0) {
713+
if(tv.tv_sec != 0 || tv.tv_usec != 0) {
714714
tv_ptr = &tv;
715715
}
716716
redis_sock->stream = php_stream_xport_create(host, host_len, ENFORCE_SAFE_MODE,

0 commit comments

Comments
 (0)