From 0511b51680d4f827cc485140249862356d232469 Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Wed, 16 Aug 1995 16:16:25 +0000 Subject: (S_socket_recv): Use pipe_release_reader instead of pipe_release. (S_socket_send): Use pipe_release_writer instead of pipe_release. (S_socket_recv): Reflect EPIPE as EOF. --- pflocal/socket.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'pflocal') diff --git a/pflocal/socket.c b/pflocal/socket.c index 9d0e1cdc..654a1d7c 100644 --- a/pflocal/socket.c +++ b/pflocal/socket.c @@ -298,7 +298,7 @@ S_socket_send (struct sock_user *user, struct addr *dest_addr, int flags, err = pipe_send (pipe, source_addr, data, data_len, control, control_len, ports, num_ports, amount); - pipe_release (pipe); + pipe_release_writer (pipe); if (err) /* The send failed, so free any resources it would have consumed (mig gets rid of memory, but we have to do everything else). */ @@ -342,13 +342,22 @@ S_socket_recv (struct sock_user *user, 0; err = sock_aquire_read_pipe (user->sock, &pipe); - if (!err) + if (err == EPIPE) + /* EOF */ + { + *data_len = 0; + if (num_ports) + *num_ports = 0; + if (control_len) + *control_len = 0; + } + else if (!err) { err = pipe_recv (pipe, user->sock->flags & SOCK_NONBLOCK, &flags, &source_addr, data, data_len, amount, control, control_len, ports, num_ports); - pipe_release (pipe); + pipe_release_reader (pipe); } if (!err) -- cgit v1.2.3