From 51f60c38c8d3cae7b0d75ba51eab5af47f6b5df7 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sat, 12 Sep 2015 14:08:17 +0200 Subject: Turn EADDRNOTAVAIL to more commonly-understood ECONNREFUSED Thanks Svante Signell for the investigation. * pflocal/socket.c (S_socket_connect, S_socket_send): When addr_get_sock returns EADDRNOTAVAIL, translate into ECONNREFUSED. --- pflocal/socket.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pflocal/socket.c b/pflocal/socket.c index 792c6379..58449047 100644 --- a/pflocal/socket.c +++ b/pflocal/socket.c @@ -92,7 +92,10 @@ S_socket_connect (struct sock_user *user, struct addr *addr) return EOPNOTSUPP; err = addr_get_sock (addr, &peer); - if (!err) + if (err == EADDRNOTAVAIL) + /* The server went away. */ + err = ECONNREFUSED; + else if (!err) { struct sock *sock = user->sock; struct connq *cq = peer->listen_queue; @@ -295,6 +298,9 @@ S_socket_send (struct sock_user *user, struct addr *dest_addr, int flags, if (dest_addr) { err = addr_get_sock (dest_addr, &dest_sock); + if (err == EADDRNOTAVAIL) + /* The server went away. */ + err = ECONNREFUSED; if (err) return err; if (sock->pipe_class != dest_sock->pipe_class) -- cgit v1.2.3