In FRSH_FORB this allows restarting resource managers without restart of fcb.
The problem of previous implementation was, that if the socket was closed but
peer structure was not unregistered the disconnected peer structure stored
fd of closed socket and when a new connection was made, the fd was the same
as stored in disconnected peer structure. Therefore the disconnected peer
appeared as alive.
port->new_peer = NULL;
}
ul_logdeb("recv fd=%d disconnect\n", iport->last_recv_fd);
- close(iport->last_recv_fd);
- /* TODO: Notify FORB about peer disconnect */
+ ul_list_for_each(forb_port_peer, port, peer) {
+ struct inet_peer *ipeer = peer->proto_priv;
+ if (ipeer && ipeer->socket == iport->last_recv_fd) {
+ forb_peer_disconnected(peer);
+ break;
+ }
+ }
iport->last_recv_fd = -1;
continue;
}
struct inet_peer *ipeer = peer->proto_priv;
if (ipeer) {
peer->proto_priv = NULL;
+ ul_logdeb("destroying peer fd=%d\n", ipeer->socket);
close(ipeer->socket);
free(ipeer);
}