diff options
author | Harald Welte <laforge@gnumonks.org> | 2012-07-13 09:57:28 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2015-11-15 14:15:19 +0100 |
commit | 4219d560711b30832ee00ee065dc50ff0af0d741 (patch) | |
tree | 69a0069b430b4f6c4c5a0805c55bb9ff957456ae | |
parent | 4cd1f353ea4ad5becd013942892a1dfa73f8fab0 (diff) |
ganc: destroy peer after read fails or RELEASE has been sent
this is not quite as per spec. We probably need a timer of twice
the KEEPALIVE timer of the MS to determine the phone is gone.
-rw-r--r-- | openbsc/src/osmo-ganc/ganc_server.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/openbsc/src/osmo-ganc/ganc_server.c b/openbsc/src/osmo-ganc/ganc_server.c index 0ba47f205..444519e1d 100644 --- a/openbsc/src/osmo-ganc/ganc_server.c +++ b/openbsc/src/osmo-ganc/ganc_server.c @@ -47,6 +47,15 @@ static void push_rc_csr_hdr(struct msgb *msg, uint8_t pdisc, uint8_t msgt) gh->msg_type = msgt; } +static void gan_peer_destroy(struct gan_peer *peer) +{ + if (!peer) + return; + + llist_del(&peer->entry); + talloc_free(peer); +} + static struct msgb *unc_msgb_alloc(void) { return msgb_alloc_headroom(1024+128, 128, "GANC Tx"); @@ -327,6 +336,10 @@ static int rx_rc_deregister(struct gan_peer *peer, struct msgb *msg, struct tlv_parsed *tp) { /* Release all resources, MS will TCP disconnect */ + + /* FIXME: not all MS really close the TPC connection, we have to + * release the TCP connection locally! */ + gan_peer_destroy(peer); return 0; } @@ -433,6 +446,7 @@ static int unc_read_cb(struct osmo_conn *conn) rc = read(conn->queue.bfd.fd, msg->data, 2); if (rc <= 0) { msgb_free(msg); + gan_peer_destroy(conn->priv); osmo_conn_close(conn); return rc; } else if (rc != 2) { |