diff options
author | Miles Bader <miles@gnu.org> | 1995-07-23 19:36:19 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 1995-07-23 19:36:19 +0000 |
commit | 21bd4df53e1a7d61e8732234efb56215cda1af5f (patch) | |
tree | 7a1df040bcea3e7a28f6f1c1b285d4f1950e7e34 | |
parent | ffd0db10698b395f2e73573434724745f3ab08a1 (diff) |
Formerly sock.c.~13~
-rw-r--r-- | pflocal/sock.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/pflocal/sock.c b/pflocal/sock.c index 0b8585ea..d8209c43 100644 --- a/pflocal/sock.c +++ b/pflocal/sock.c @@ -273,7 +273,6 @@ addr_clean (void *vaddr) it. */ debug (addr, "bye"); assert (addr->sock == NULL); - free (addr); } /* Return a new address, not connected to any socket yet, ADDR. */ @@ -441,8 +440,11 @@ debug (sock1, "socket pair lock"); mutex_lock (&socket_pair_lock); debug (sock1, "lock"); mutex_lock (&sock1->lock); -debug (sock2, "lock"); - mutex_lock (&sock2->lock); + if (sock1 != sock2) + /* If SOCK1 == SOCK2, then we get a fifo! */ +{debug (sock2, "lock"); + mutex_lock (&sock2->lock); +} if ((sock1->flags & SOCK_CONNECTED) || (sock2->flags & SOCK_CONNECTED)) /* An already-connected socket. */ @@ -460,14 +462,19 @@ debug (sock2, "lock"); /* Only make the reverse for connection-oriented protocols. */ if (! connless) { - connect (sock2, sock1); sock1->flags |= SOCK_CONNECTED; - sock2->flags |= SOCK_CONNECTED; + if (sock1 != sock2) + { + connect (sock2, sock1); + sock2->flags |= SOCK_CONNECTED; + } } } -debug (sock2, "unlock"); - mutex_unlock (&sock2->lock); + if (sock1 != sock2) +{debug (sock2, "unlock"); + mutex_unlock (&sock2->lock); +} debug (sock1, "unlock"); mutex_unlock (&sock1->lock); debug (sock1, "socket pair unlock"); |