X-Git-Url: https://rtime.felk.cvut.cz/gitweb/frescor/forb.git/blobdiff_plain/acf8494a9b320a49b9fe58bf6b9668f2a703c4b9..1a096e992dc737d8886d206faf89cd7099536910:/src/port.c diff --git a/src/port.c b/src/port.c index 60121b0..0c54c40 100644 --- a/src/port.c +++ b/src/port.c @@ -61,6 +61,7 @@ #include #include "iop.h" #include +#include "discovery.h" extern UL_LOG_CUST(ulogd_forb_port); @@ -168,14 +169,19 @@ void forb_destroy_port(forb_port_t *port) pthread_join(port->discovery_thread.pthread_id, &thread_return); #endif + /* Because of no locking of port->peers, this must be called + * after receiver thread is stopped. */ + forb_peer_t *peer; + ul_list_for_each_cut(forb_port_peer, port, peer) { + forb_peer_get(peer); + forb_peer_disconnected(peer); + forb_peer_put(peer); + } + if (port->desc.proto->port_destroy) { port->desc.proto->port_destroy(port); } - /* Because of no locking of port->peers, this must be called - * after receiver thread is stopped. */ - forb_peer_delete_by_port(forb, port); - FORB_CDR_codec_release_buffer(&port->codec); fosa_mutex_lock(&forb->port_mutex);