diff options
author | Miles Bader <miles@gnu.org> | 1995-08-16 16:16:25 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 1995-08-16 16:16:25 +0000 |
commit | 0511b51680d4f827cc485140249862356d232469 (patch) | |
tree | d9383a9f10f80d930b125d59797700ea517fbb53 | |
parent | 7f8571d0ab23a9ba53813217a585d756163d4746 (diff) |
(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.
-rw-r--r-- | pflocal/socket.c | 15 |
1 files changed, 12 insertions, 3 deletions
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) |