Move wakeup into the main thread to remove complexity. Looks like CLOCK_MONOTONIC_COARSE doesn't need a syscall.

This commit is contained in:
Ian Gulliver
2016-02-22 14:37:00 -08:00
parent 70cfaa94aa
commit f255170967
5 changed files with 53 additions and 130 deletions

View File

@@ -100,6 +100,7 @@ static void outgoing_connect_result(struct outgoing *outgoing, int result) {
default:
fprintf(stderr, "O %s: Can't connect to %s/%s: %s\n", outgoing->id, hbuf, sbuf, strerror(result));
assert(!close(outgoing->peer.fd));
outgoing->peer.fd = -1;
outgoing->addr = outgoing->addr->ai_next;
// Tail recursion :/
outgoing_connect_next(outgoing);
@@ -130,7 +131,9 @@ static void outgoing_resolve_wrapper(struct peer *peer) {
}
static void outgoing_del(struct outgoing *outgoing) {
assert(!close(outgoing->peer.fd));
if (outgoing->peer.fd >= 0) {
assert(!close(outgoing->peer.fd));
}
free(outgoing->node);
free(outgoing->service);
free(outgoing);