This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
laforge gerrit-no-reply at lists.osmocom.orglaforge has submitted this change and it was merged. ( https://gerrit.osmocom.org/c/osmo-sip-connector/+/15303 )
Change subject: mncc: check fd before closing a connection
......................................................................
mncc: check fd before closing a connection
The function close_connection() closes the fd without marking it as
closed. Lets set the fd to -1 and check at the beginning if it is
greater than zero. This prevents us from closing an already closed fd
again.
Related: OS#4159
Change-Id: I9742f31a37296fed15d54cf44c1f65b93abb8c8e
---
M src/mncc.c
1 file changed, 6 insertions(+), 0 deletions(-)
Approvals:
Jenkins Builder: Verified
pespin: Looks good to me, but someone else must approve
laforge: Looks good to me, approved
diff --git a/src/mncc.c b/src/mncc.c
index e23bd6f..f2e2579 100644
--- a/src/mncc.c
+++ b/src/mncc.c
@@ -324,8 +324,12 @@
/* Close the MNCC connection/socket */
static void close_connection(struct mncc_connection *conn)
{
+ if (conn->fd.fd < 0)
+ return;
+
osmo_fd_unregister(&conn->fd);
close(conn->fd.fd);
+ conn->fd.fd = -1;
osmo_timer_schedule(&conn->reconnect, 5, 0);
conn->state = MNCC_DISCONNECTED;
if (conn->on_disconnect)
@@ -924,6 +928,7 @@
LOGP(DMNCC, LOGL_ERROR, "Failed to connect(%s). Retrying\n",
conn->app->mncc.path);
conn->state = MNCC_DISCONNECTED;
+ conn->fd.fd = -1;
osmo_timer_schedule(&conn->reconnect, 5, 0);
return;
}
@@ -1022,6 +1027,7 @@
conn->reconnect.data = conn;
conn->fd.cb = mncc_data;
conn->fd.data = conn;
+ conn->fd.fd = -1;
conn->app = cfg;
conn->state = MNCC_DISCONNECTED;
}
--
To view, visit https://gerrit.osmocom.org/c/osmo-sip-connector/+/15303
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-sip-connector
Gerrit-Branch: master
Gerrit-Change-Id: I9742f31a37296fed15d54cf44c1f65b93abb8c8e
Gerrit-Change-Number: 15303
Gerrit-PatchSet: 5
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: fixeria <axilirator at gmail.com>
Gerrit-Reviewer: laforge <laforge at gnumonks.org>
Gerrit-Reviewer: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190902/4a483e6f/attachment.htm>