@@ -167,6 +167,7 @@ _mongoc_socket_wait (int sd, /* IN */
167
167
} else if (ret < 0 ) {
168
168
/* poll itself failed */
169
169
170
+ TRACE ("errno is: %d" , errno );
170
171
if (MONGOC_ERRNO_IS_AGAIN (errno )) {
171
172
now = bson_get_monotonic_time ();
172
173
@@ -265,6 +266,7 @@ _mongoc_socket_capture_errno (mongoc_socket_t *sock) /* IN */
265
266
#else
266
267
sock -> errno_ = errno ;
267
268
#endif
269
+ TRACE ("setting errno: %d" , sock -> errno_ );
268
270
}
269
271
270
272
@@ -335,7 +337,6 @@ mongoc_socket_accept (mongoc_socket_t *sock, /* IN */
335
337
sd = accept (sock -> sd , & addr , & addrlen );
336
338
337
339
_mongoc_socket_capture_errno (sock );
338
-
339
340
#ifdef _WIN32
340
341
failed = (sd == INVALID_SOCKET );
341
342
#else
@@ -702,7 +703,6 @@ mongoc_socket_recv (mongoc_socket_t *sock, /* IN */
702
703
{
703
704
ssize_t ret = 0 ;
704
705
bool failed = false;
705
- bool try_again = false;
706
706
707
707
ENTRY ;
708
708
@@ -721,11 +721,8 @@ mongoc_socket_recv (mongoc_socket_t *sock, /* IN */
721
721
#endif
722
722
if (failed ) {
723
723
_mongoc_socket_capture_errno (sock );
724
- }
725
- try_again = (failed && _mongoc_socket_errno_is_again (sock ));
726
-
727
- if (failed && try_again ) {
728
- if (_mongoc_socket_wait (sock -> sd , POLLIN , expire_at )) {
724
+ if (_mongoc_socket_errno_is_again (sock ) &&
725
+ _mongoc_socket_wait (sock -> sd , POLLIN , expire_at )) {
729
726
GOTO (again );
730
727
}
731
728
}
@@ -928,27 +925,30 @@ _mongoc_socket_try_sendv (mongoc_socket_t *sock, /* IN */
928
925
ret = sendmsg (sock -> sd , & msg ,
929
926
# ifdef MSG_NOSIGNAL
930
927
MSG_NOSIGNAL );
931
- #else
928
+ # else
932
929
0 );
933
930
# endif
934
931
#endif
935
932
936
- TRACE ("Send %ld out of %ld bytes (errno=%d)" , ret , iov -> iov_len , errno );
937
- /*
938
- * Check to see if we have sent an iovec too large for sendmsg to
939
- * complete. If so, we need to fallback to the slow path of multiple
940
- * send() commands.
941
- */
933
+ TRACE ("Send %ld out of %ld bytes" , ret , iov -> iov_len );
934
+
935
+ if (ret == -1 ) {
936
+ _mongoc_socket_capture_errno (sock );
937
+
938
+ /*
939
+ * Check to see if we have sent an iovec too large for sendmsg to
940
+ * complete. If so, we need to fallback to the slow path of multiple
941
+ * send() commands.
942
+ */
942
943
#ifdef _WIN32
943
- if (( ret == -1 ) && (errno == WSAEMSGSIZE ) ) {
944
+ if (errno == WSAEMSGSIZE ) {
944
945
#else
945
- if (( ret == -1 ) && (errno == EMSGSIZE ) ) {
946
+ if (errno == EMSGSIZE ) {
946
947
#endif
947
- RETURN (_mongoc_socket_try_sendv_slow (sock , iov , iovcnt ));
948
+ RETURN (_mongoc_socket_try_sendv_slow (sock , iov , iovcnt ));
949
+ }
948
950
}
949
951
950
- _mongoc_socket_capture_errno (sock );
951
-
952
952
RETURN (ret );
953
953
}
954
954
0 commit comments