aboutsummaryrefslogtreecommitdiffstats
path: root/src/gb/gprs_ns.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gb/gprs_ns.c')
-rw-r--r--src/gb/gprs_ns.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/gb/gprs_ns.c b/src/gb/gprs_ns.c
index 9b7cc056..1281c9f4 100644
--- a/src/gb/gprs_ns.c
+++ b/src/gb/gprs_ns.c
@@ -1413,8 +1413,16 @@ int gprs_ns_process_msg(struct gprs_ns_inst *nsi, struct msgb *msg,
/* Section 7.2: unblocking procedure */
LOGP(DNS, LOGL_INFO, "NSEI=%u Rx NS UNBLOCK\n", (*nsvc)->nsei);
ns_mark_unblocked(*nsvc);
- ns_osmo_signal_dispatch(*nsvc, S_NS_UNBLOCK, 0);
+ /* This UNBLOCK_ACK message will cause our peer to move us into NS_UNBLOCKED state. */
rc = gprs_ns_tx_simple(*nsvc, NS_PDUT_UNBLOCK_ACK);
+ if (rc < 0)
+ break;
+ /*
+ * UNBLOCK_ACK has been transmitted.
+ * Signal handlers may send additional messages following UNBLOCK_ACK under
+ * the assumption that NS is now in UNBLOCKED state at our peer's end.
+ */
+ ns_osmo_signal_dispatch(*nsvc, S_NS_UNBLOCK, 0);
break;
case NS_PDUT_UNBLOCK_ACK:
LOGP(DNS, LOGL_INFO, "NSEI=%u Rx NS UNBLOCK ACK\n", (*nsvc)->nsei);
@@ -1628,8 +1636,11 @@ int gprs_ns_nsip_listen(struct gprs_ns_inst *nsi)
LOGP(DNS, LOGL_NOTICE, "Listening for nsip packets on %s:%u\n", inet_ntoa(in), nsi->nsip.local_port);
}
- if (ret < 0)
+ if (ret < 0) {
+ nsi->nsip.fd.cb = NULL;
+ nsi->nsip.fd.data = NULL;
return ret;
+ }
ret = setsockopt(nsi->nsip.fd.fd, IPPROTO_IP, IP_TOS,
&nsi->nsip.dscp, sizeof(nsi->nsip.dscp));