From patchwork Wed May 25 16:52:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: gerrit-no-reply@lists.osmocom.org X-Patchwork-Id: 626280 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.osmocom.org (lists.osmocom.org [144.76.43.76]) by ozlabs.org (Postfix) with ESMTP id 3rFJGn04jLz9sdn for ; Thu, 26 May 2016 02:52:03 +1000 (AEST) Received: from lists.osmocom.org (lists.osmocom.org [144.76.43.76]) by lists.osmocom.org (Postfix) with ESMTP id BB5516F9C; Wed, 25 May 2016 16:52:01 +0000 (UTC) X-Original-To: openbsc@lists.osmocom.org Delivered-To: openbsc@lists.osmocom.org Received: from 127.0.1.12 (unknown [127.0.1.12]) by lists.osmocom.org (Postfix) with ESMTPA id 307FA6F5C for ; Wed, 25 May 2016 16:52:00 +0000 (UTC) Date: Wed, 25 May 2016 16:52:00 +0000 From: daniel Message-ID: X-Gerrit-MessageType: newchange Subject: [PATCH] libosmo-netif[master]: osmux: Pass circuit to _batch_del_circuit() and use it from ... X-Gerrit-Change-Id: If224980123d4a369133499ab7b577d02511f4055 X-Gerrit-ChangeURL: X-Gerrit-Commit: 08f23fdc9f24f94f73e546f2128f0a7d194b7825 MIME-Version: 1.0 Content-Disposition: inline User-Agent: Gerrit/2.12.2-31-gb331dbd-dirty X-BeenThere: openbsc@lists.osmocom.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Development of OpenBSC, OsmoBSC, OsmoNITB, OsmoCSCN" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: dwillmann@sysmocom.de Errors-To: openbsc-bounces@lists.osmocom.org Sender: "OpenBSC" Review at https://gerrit.osmocom.org/119 osmux: Pass circuit to _batch_del_circuit() and use it from _xfrm_input_fini() Change-Id: If224980123d4a369133499ab7b577d02511f4055 Ticket: OS#1733 --- M src/osmux.c 1 file changed, 8 insertions(+), 10 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/19/119/1 diff --git a/src/osmux.c b/src/osmux.c index 8025d5d..44b4b96 100644 --- a/src/osmux.c +++ b/src/osmux.c @@ -533,14 +533,8 @@ return circuit; } -static void osmux_batch_del_circuit(struct osmux_batch *batch, int ccid) +static void osmux_batch_del_circuit(struct osmux_batch *batch, struct osmux_circuit *circuit) { - struct osmux_circuit *circuit; - - circuit = osmux_batch_find_circuit(batch, ccid); - if (circuit == NULL) - return; - if (circuit->dummy) batch->ndummy--; llist_del(&circuit->head); @@ -713,8 +707,13 @@ void osmux_xfrm_input_close_circuit(struct osmux_in_handle *h, int ccid) { struct osmux_batch *batch = (struct osmux_batch *)h->internal_data; + struct osmux_circuit *circuit; - osmux_batch_del_circuit(batch, ccid); + circuit = osmux_batch_find_circuit(batch, ccid); + if (circuit == NULL) + return; + + osmux_batch_del_circuit(batch, circuit); } void osmux_xfrm_input_fini(struct osmux_in_handle *h) @@ -723,8 +722,7 @@ struct osmux_circuit *circuit, *next; llist_for_each_entry_safe(circuit, next, &batch->circuit_list, head) { - llist_del(&circuit->head); - talloc_free(circuit); + osmux_batch_del_circuit(batch, circuit); } osmo_timer_del(&batch->timer); talloc_free(batch);