From 953ca274ae57f8edd12536a3dd15d134aa6e5576 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Fri, 6 Jul 2018 14:42:53 -0700 Subject: fixes #568 Want a single reader/write lock on socket child objects fixes #170 Make more use of reaper This is a complete restructure/rethink of how child objects interact with the socket. (This also backs out #576 as it turns out not to be needed.) While 568 says reader/writer lock, for now we have settled for a single writer lock. Its likely that this is sufficient. Essentially we use the single socket lock to guard lists of the socket children. We also use deferred deletion in the idhash to facilitate teardown, which means endpoint closes are no longer synchronous. We use the reaper to clean up objects when the reference count drops to zero. We make a special exception for pipes, since they really are not reference counted by their parents, and they are leaf objects anyway. We believe this addresses the main outstanding race conditions in a much more correct and holistic way. Note that endpoint shutdown is a little tricky, as it makes use of atomic flags to guard against double entry, and against recursive lock entry. This is something that would be nice to make a bit more obvious, but what we have is safe, and the complexity is at least confined to one place. --- src/core/dialer.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/core/dialer.h') diff --git a/src/core/dialer.h b/src/core/dialer.h index 56b0fb1b..4a3e127c 100644 --- a/src/core/dialer.h +++ b/src/core/dialer.h @@ -18,11 +18,8 @@ extern int nni_dialer_hold(nni_dialer *); extern void nni_dialer_rele(nni_dialer *); extern uint32_t nni_dialer_id(nni_dialer *); extern int nni_dialer_create(nni_dialer **, nni_sock *, const char *); -extern int nni_dialer_shutdown(nni_dialer *); extern void nni_dialer_close(nni_dialer *); extern int nni_dialer_start(nni_dialer *, int); -extern void nni_dialer_list_init(nni_list *); -extern void nni_dialer_remove_pipe(nni_dialer *, nni_pipe *); extern int nni_dialer_setopt( nni_dialer *, const char *, const void *, size_t, nni_opt_type); -- cgit v1.2.3-70-g09d2