Skip to content

Commit 57ed2c9

Browse files
committed
Properly block on socket writes
If a socket write returns EWOULDBLOCK PHP will poll() using the socket read timeout. This is only an issue when writing crazy amount of data to a non-blocking socket in multiple iterations... which we do.
1 parent ddc558e commit 57ed2c9

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

php_phongo.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,7 @@ ssize_t phongo_stream_writev(mongoc_stream_t *stream, mongoc_iovec_t *iov, size_
687687
php_phongo_stream_socket *base_stream = (php_phongo_stream_socket *)stream;
688688
TSRMLS_FETCH_FROM_CTX(base_stream->tsrm_ls);
689689

690+
php_phongo_set_timeout(base_stream, timeout_msec);
690691
for (i = 0; i < iovcnt; i++) {
691692
sent += php_stream_write(base_stream->stream, iov[i].iov_base, iov[i].iov_len);
692693
}

0 commit comments

Comments
 (0)