wpaul 469d167428 Make _yp_dobind() a litle smarter:
Now that we preserve RPC handles instead of rebuilding them each time
a ypcln function is called, we have to be careful about keeping our sockets
in a sane state. It's possible that the caller may call a ypclnt
function, and then decide to close all its file descriptors. This would
also close the socket descriptor held by the yplib code. Worse, it
could re-open the same descriptor number for its own use. If it then calls
another ypclnt function, the subsequent RPC will fail because the socket
will either be gone or replaced with Something Completely Different. The
yplib code will recover by rebinding, but it doing so it may wreck the
descriptor which now belongs to the caller.

To fix this, _yp_dobind() needs to label the descriptor somehow so
that it can test it later to make sure it hasn't been altered between
ypclnt calls. It does this by binding the socket, thus associating a port
number with it. It then saves this port number in the dom_local_port member
of the dom_binding structure for the given domain. When _yp_dobind() is
called again (which it is at the start of each ypclnt function), it checks
to see if the domain is already bound, and if it is, it does a getsockname()
on the socket and compares the port number to the one it saved. If the
getsockname() fails, or the port number doesn't match, it abandons the
socket and sets up a new client handle.

This still incurs some syscall overhead, which is what I was trying to
avoid, but it's still not as bad as before.
1996-06-01 05:08:31 +00:00
..
1996-05-07 23:19:49 +00:00
1996-06-01 05:08:31 +00:00
1996-05-07 23:19:49 +00:00
1995-05-30 05:51:47 +00:00
1996-05-07 23:19:49 +00:00
1995-12-30 19:02:48 +00:00
1996-02-12 12:40:04 +00:00
1996-05-30 22:54:10 +00:00
1996-02-12 12:40:04 +00:00
1996-05-07 23:19:49 +00:00
1996-05-02 09:23:36 +00:00
1996-05-07 23:19:49 +00:00
1996-05-30 23:01:04 +00:00
1996-05-07 23:19:49 +00:00
1994-05-27 05:00:24 +00:00
1996-05-07 23:19:49 +00:00
1995-12-30 19:02:48 +00:00
1994-05-27 05:00:24 +00:00
1996-02-25 20:29:46 +00:00
1996-03-18 18:59:08 +00:00