ns2: refactor handle_nsip_read/handle_nsfrgre_read
Might be more readable.
Change-Id: Ib2dbcae55a8c7a973cfa1123784f509708de7f3b
diff --git a/src/gb/gprs_ns2_udp.c b/src/gb/gprs_ns2_udp.c
index 2f55f2a..bda0acf 100644
--- a/src/gb/gprs_ns2_udp.c
+++ b/src/gb/gprs_ns2_udp.c
@@ -195,12 +195,11 @@
rc = ns2_create_vc(bind, msg, "newconnection", &reject, &nsvc);
switch (rc) {
case GPRS_NS2_CS_FOUND:
- rc = ns2_recv_vc(nsvc, msg);
break;
case GPRS_NS2_CS_ERROR:
case GPRS_NS2_CS_SKIPPED:
rc = 0;
- break;
+ goto out;
case GPRS_NS2_CS_REJECTED:
/* nsip_sendmsg will free reject */
nsip_sendmsg(bind, reject, &saddr);
@@ -208,14 +207,12 @@
case GPRS_NS2_CS_CREATED:
ns2_driver_alloc_vc(bind, nsvc, &saddr);
gprs_ns2_vc_fsm_start(nsvc);
- rc = ns2_recv_vc(nsvc, msg);
break;
}
- } else {
- /* VC found */
- rc = ns2_recv_vc(nsvc, msg);
}
+ rc = ns2_recv_vc(nsvc, msg);
+out:
msgb_free(msg);
return rc;