|
17 | 17 |
|
18 | 18 | #include "mongoc-config.h"
|
19 | 19 |
|
20 |
| -#include <errno.h> |
21 | 20 | #ifdef MONGOC_ENABLE_SASL
|
22 | 21 | #include <sasl/sasl.h>
|
23 | 22 | #include <sasl/saslutil.h>
|
@@ -954,9 +953,9 @@ _mongoc_cluster_run_command (mongoc_cluster_t *cluster,
|
954 | 953 | _mongoc_rpc_swab_to_le(&rpc);
|
955 | 954 |
|
956 | 955 | DUMP_IOVEC (((mongoc_iovec_t *)ar.data), ((mongoc_iovec_t *)ar.data), ar.len);
|
957 |
| - if (!mongoc_stream_writev(node->stream, ar.data, ar.len, |
958 |
| - cluster->sockettimeoutms)) { |
959 |
| - GOTO(failure); |
| 956 | + if (!_mongoc_stream_writev_full (node->stream, ar.data, ar.len, |
| 957 | + cluster->sockettimeoutms, error)) { |
| 958 | + GOTO (failure); |
960 | 959 | }
|
961 | 960 |
|
962 | 961 | if (!_mongoc_buffer_append_from_stream(&buffer, node->stream, 4,
|
@@ -2892,21 +2891,11 @@ _mongoc_cluster_sendv (mongoc_cluster_t *cluster,
|
2892 | 2891 |
|
2893 | 2892 | iov = cluster->iov.data;
|
2894 | 2893 | iovcnt = cluster->iov.len;
|
2895 |
| - errno = 0; |
2896 | 2894 |
|
2897 | 2895 | BSON_ASSERT (cluster->iov.len);
|
2898 | 2896 |
|
2899 |
| - if (!mongoc_stream_writev (node->stream, iov, iovcnt, |
2900 |
| - cluster->sockettimeoutms)) { |
2901 |
| - char buf[128]; |
2902 |
| - char * errstr; |
2903 |
| - errstr = bson_strerror_r(errno, buf, sizeof buf); |
2904 |
| - |
2905 |
| - bson_set_error (error, |
2906 |
| - MONGOC_ERROR_STREAM, |
2907 |
| - MONGOC_ERROR_STREAM_SOCKET, |
2908 |
| - "Failure during socket delivery: %s", |
2909 |
| - errstr); |
| 2897 | + if (!_mongoc_stream_writev_full (node->stream, iov, iovcnt, |
| 2898 | + cluster->sockettimeoutms, error)) { |
2910 | 2899 | _mongoc_cluster_disconnect_node (cluster, node);
|
2911 | 2900 | RETURN (0);
|
2912 | 2901 | }
|
@@ -3037,17 +3026,8 @@ _mongoc_cluster_try_sendv (mongoc_cluster_t *cluster,
|
3037 | 3026 |
|
3038 | 3027 | DUMP_IOVEC (iov, iov, iovcnt);
|
3039 | 3028 |
|
3040 |
| - if (!mongoc_stream_writev (node->stream, iov, iovcnt, |
3041 |
| - cluster->sockettimeoutms)) { |
3042 |
| - char buf[128]; |
3043 |
| - char * errstr; |
3044 |
| - errstr = bson_strerror_r(errno, buf, sizeof buf); |
3045 |
| - |
3046 |
| - bson_set_error (error, |
3047 |
| - MONGOC_ERROR_STREAM, |
3048 |
| - MONGOC_ERROR_STREAM_SOCKET, |
3049 |
| - "Failure during socket delivery: %s", |
3050 |
| - errstr); |
| 3029 | + if (!_mongoc_stream_writev_full (node->stream, iov, iovcnt, |
| 3030 | + cluster->sockettimeoutms, error)) { |
3051 | 3031 | _mongoc_cluster_disconnect_node (cluster, node);
|
3052 | 3032 | RETURN (0);
|
3053 | 3033 | }
|
|
0 commit comments