agent: Handle EPIPE from pseudo_tcp_socket_send()
authorPhilip Withnall <philip.withnall@collabora.co.uk>
Fri, 8 Aug 2014 07:46:25 +0000 (08:46 +0100)
committerOlivier Crête <olivier.crete@collabora.com>
Thu, 21 Aug 2014 18:33:11 +0000 (14:33 -0400)
As with send(), pseudo_tcp_socket_send() may return EPIPE if the local
side of the connection has been closed using close() or shutdown(). It
currently doesn’t, but will do once pseudo-TCP FIN–ACK support has been
implemented.

agent/agent.c

index 010c8e5..d1ab7aa 100644 (file)
@@ -1455,7 +1455,8 @@ pseudo_tcp_socket_send_messages (PseudoTcpSocket *self,
         if (pseudo_tcp_socket_get_error (self) == EWOULDBLOCK)
           goto out;
 
-        if (pseudo_tcp_socket_get_error (self) == ENOTCONN)
+        if (pseudo_tcp_socket_get_error (self) == ENOTCONN ||
+            pseudo_tcp_socket_get_error (self) == EPIPE)
           g_set_error (error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK,
               "TCP connection is not yet established.");
         else