stream: Unset fd value after close() before calling closed_cb()

The fd is not valid anymore after close() call, so let's set it to a
clearly invalid value, to avoid confusion on closed_cb() users
attempting to use the fd get info about the socket at that time.

Change-Id: I82d9bdfb38cf5e9f689eca0d9a4c19ddd5541af7
changes/35/29335/1
Pau Espin 5 months ago
parent 2087d61c21
commit 98c75ef273
  1. 3
      src/stream.c

@ -1439,8 +1439,9 @@ struct osmo_stream_srv_link *osmo_stream_srv_get_master(struct osmo_stream_srv *
* \param[in] conn Stream Server to be destroyed */
void osmo_stream_srv_destroy(struct osmo_stream_srv *conn)
{
close(conn->ofd.fd);
osmo_fd_unregister(&conn->ofd);
close(conn->ofd.fd);
conn->ofd.fd = -1;
if (conn->closed_cb)
conn->closed_cb(conn);
msgb_queue_free(&conn->tx_queue);

Loading…
Cancel
Save