8d7563a9c3
Sometimes, but not always, the pkd tests will fail because they close the socket at hand a bit too early for the client. The client in turn may exit non-zero when that happens. Split up the final close loop so that pkd waits to receive a channel close from the client, and then socket close, before finally returning. With this change I observe that tests are now passing in environments that would previously tickle the above race and fail. Signed-off-by: Jon Simons <jon@jonsimons.org> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>