summaryrefslogtreecommitdiff
path: root/sysdep/unix/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdep/unix/io.c')
-rw-r--r--sysdep/unix/io.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/sysdep/unix/io.c b/sysdep/unix/io.c
index 40a6f114..b21df057 100644
--- a/sysdep/unix/io.c
+++ b/sysdep/unix/io.c
@@ -1052,6 +1052,10 @@ sk_passive_connected(sock *s, int type)
return 0;
}
+ struct domain_generic *sock_lock = DG_IS_LOCKED(s->pool->domain) ? NULL : s->pool->domain;
+ if (sock_lock)
+ DG_LOCK(sock_lock);
+
sock *t = sk_new(s->pool);
t->type = type;
t->data = s->data;
@@ -1082,13 +1086,20 @@ sk_passive_connected(sock *s, int type)
close(t->fd);
t->fd = -1;
sk_close(t);
- return 1;
+ t = NULL;
+ }
+ else
+ {
+ birdloop_add_socket(s->loop, t);
+ sk_alloc_bufs(t);
}
- birdloop_add_socket(s->loop, t);
+ if (sock_lock)
+ DG_UNLOCK(sock_lock);
+
+ if (t)
+ s->rx_hook(t, 0);
- sk_alloc_bufs(t);
- s->rx_hook(t, 0);
return 1;
}