aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2016-08-06 03:09:35 +0200
committerMattias Andrée <maandree@kth.se>2016-08-06 03:09:35 +0200
commit65b72b4aaa2a6a09ec8d91e20aa469af69497676 (patch)
tree8ff95c5d2b1f5bfb01f434f3d01e80a4a34ebfb3 /src
parentm (diff)
downloadmds-65b72b4aaa2a6a09ec8d91e20aa469af69497676.tar.gz
mds-65b72b4aaa2a6a09ec8d91e20aa469af69497676.tar.bz2
mds-65b72b4aaa2a6a09ec8d91e20aa469af69497676.tar.xz
If send fails with EPIPE, set errno to ECONNRESET instead
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r--src/libmdsclient/comm.c4
-rw-r--r--src/libmdsclient/comm.h2
-rw-r--r--src/libmdsserver/util.c2
3 files changed, 4 insertions, 4 deletions
diff --git a/src/libmdsclient/comm.c b/src/libmdsclient/comm.c
index 34c145f..c4ba23c 100644
--- a/src/libmdsclient/comm.c
+++ b/src/libmdsclient/comm.c
@@ -232,7 +232,6 @@ int libmds_connection_establish_address(libmds_connection_t* restrict this,
* @throws ENOMEM See send(2)
* @throws ENOTCONN See send(2)
* @throws ENOTSOCK See send(2)
- * @throws EPIPE See send(2)
* @throws See pthread_mutex_lock(3)
*/
size_t libmds_connection_send(libmds_connection_t* restrict this, const char* restrict message, size_t length)
@@ -274,7 +273,6 @@ size_t libmds_connection_send(libmds_connection_t* restrict this, const char* re
* @throws ENOMEM See send(2)
* @throws ENOTCONN See send(2)
* @throws ENOTSOCK See send(2)
- * @throws EPIPE See send(2)
*/
size_t libmds_connection_send_unlocked(libmds_connection_t* restrict this, const char* restrict message,
size_t length, int continue_on_interrupt)
@@ -287,6 +285,8 @@ size_t libmds_connection_send_unlocked(libmds_connection_t* restrict this, const
while (length > 0)
if ((just_sent = send(this->socket_fd, message + sent, min(block_size, length), MSG_NOSIGNAL)) < 0)
{
+ if (errno == EPIPE)
+ errno = ECONNRESET;
if (errno == EMSGSIZE)
{
block_size >>= 1;
diff --git a/src/libmdsclient/comm.h b/src/libmdsclient/comm.h
index bb8f880..a162d0a 100644
--- a/src/libmdsclient/comm.h
+++ b/src/libmdsclient/comm.h
@@ -177,7 +177,6 @@ int libmds_connection_establish_address(libmds_connection_t* restrict this,
* @throws ENOMEM See send(2)
* @throws ENOTCONN See send(2)
* @throws ENOTSOCK See send(2)
- * @throws EPIPE See send(2)
* @throws See pthread_mutex_lock(3)
*/
__attribute__((nonnull))
@@ -206,7 +205,6 @@ size_t libmds_connection_send(libmds_connection_t* restrict this, const char* re
* @throws ENOMEM See send(2)
* @throws ENOTCONN See send(2)
* @throws ENOTSOCK See send(2)
- * @throws EPIPE See send(2)
*/
__attribute__((nonnull))
size_t libmds_connection_send_unlocked(libmds_connection_t* restrict this, const char* restrict message,
diff --git a/src/libmdsserver/util.c b/src/libmdsserver/util.c
index a3e18a9..a598fb0 100644
--- a/src/libmdsserver/util.c
+++ b/src/libmdsserver/util.c
@@ -196,6 +196,8 @@ size_t send_message(int socket, const char* message, size_t length)
while (length > 0)
if ((just_sent = send(socket, message + sent, min(block_size, length), MSG_NOSIGNAL)) < 0)
{
+ if (errno == EPIPE)
+ errno = ECONNRESET;
if (errno == EMSGSIZE)
{
block_size >>= 1;