[osmo-pcu,1/1] Always exit and don't try to recover
diff mbox

Message ID 650b5f749cdd4f1fa49db282380a5ca8ebfb9818.1401899459.git.daniel@totalueberwachung.de
State Accepted
Headers show

Commit Message

Daniel Willmann June 4, 2014, 4:30 p.m. UTC
From: Daniel Willmann <dwillmann@sysmocom.de>

The current code tries to recover from dropped connections and resets the
pcu state so it can keep running. However, this never worked correctly
which is why the -e option is used. This option exits the pcu as soon as
the internal state needs to be reset.

This patch removes this option and makes this behaviour default.

Ticket: SYS#390
Sponsored-by: On-Waves ehf
---
 src/gprs_bssgp_pcu.cpp | 13 +------------
 src/gprs_bssgp_pcu.h   |  4 +---
 src/openbts_sock.cpp   |  4 +++-
 src/pcu_l1_if.cpp      |  4 ++--
 src/pcu_main.cpp       |  3 +--
 src/sysmo_sock.cpp     |  8 ++------
 6 files changed, 10 insertions(+), 26 deletions(-)

Patch
diff mbox

diff --git a/src/gprs_bssgp_pcu.cpp b/src/gprs_bssgp_pcu.cpp
index 133eb97..6c5d72c 100644
--- a/src/gprs_bssgp_pcu.cpp
+++ b/src/gprs_bssgp_pcu.cpp
@@ -533,13 +533,8 @@  struct gprs_bssgp_pcu *gprs_bssgp_create_and_connect(struct gprs_rlcmac_bts *bts
 	return &the_pcu;
 }
 
-void gprs_bssgp_destroy_or_exit(void)
+void gprs_bssgp_destroy(void)
 {
-	if (the_pcu.exit_on_destroy) {
-		LOGP(DBSSGP, LOGL_NOTICE, "Exiting on BSSGP destruction.\n");
-		exit(0);
-	}
-
 	if (!bssgp_nsi)
 		return;
 
@@ -564,12 +559,6 @@  void gprs_bssgp_destroy_or_exit(void)
 	bssgp_nsi = NULL;
 }
 
-void gprs_bssgp_exit_on_destroy(void)
-{
-	LOGP(DBSSGP, LOGL_NOTICE, "Going to quit on BSSGP destruction\n");
-	the_pcu.exit_on_destroy = 1;
-}
-
 struct bssgp_bvc_ctx *gprs_bssgp_pcu_current_bctx(void)
 {
 	return the_pcu.bctx;
diff --git a/src/gprs_bssgp_pcu.h b/src/gprs_bssgp_pcu.h
index aedcfc0..32b6728 100644
--- a/src/gprs_bssgp_pcu.h
+++ b/src/gprs_bssgp_pcu.h
@@ -57,7 +57,6 @@  struct gprs_bssgp_pcu {
 	int bvc_sig_reset;
 	int bvc_reset;
 	int bvc_unblocked;
-	int exit_on_destroy;
 
 	/** callbacks below */
 
@@ -75,8 +74,7 @@  struct gprs_bssgp_pcu *gprs_bssgp_create_and_connect(struct gprs_rlcmac_bts *bts
 		uint16_t nsvci, uint16_t bvci, uint16_t mcc, uint16_t mnc,
 		uint16_t lac, uint16_t rac, uint16_t cell_id);
 
-void gprs_bssgp_exit_on_destroy(void);
-void gprs_bssgp_destroy_or_exit(void);
+void gprs_bssgp_destroy(void);
 
 struct bssgp_bvc_ctx *gprs_bssgp_pcu_current_bctx(void);
 
diff --git a/src/openbts_sock.cpp b/src/openbts_sock.cpp
index a09f834..2d9cae4 100644
--- a/src/openbts_sock.cpp
+++ b/src/openbts_sock.cpp
@@ -179,8 +179,10 @@  int pcu_l1if_open()
 
 void pcu_l1if_close(void)
 {
-	gprs_bssgp_destroy_or_exit();
+	gprs_bssgp_destroy();
 
 	/* FIXME: cleanup l1if */
 	talloc_free(l1fh->fl1h);
+
+	exit(0);
 }
diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp
index ce13b96..0cb79eb 100644
--- a/src/pcu_l1_if.cpp
+++ b/src/pcu_l1_if.cpp
@@ -324,8 +324,8 @@  bssgp_failed:
 			for (ts = 0; ts < 8; ts++)
 				bts->trx[trx].pdch[ts].free_resources();
 		}
-		gprs_bssgp_destroy_or_exit();
-		return 0;
+		gprs_bssgp_destroy();
+		exit(0);
 	}
 	LOGP(DL1IF, LOGL_INFO, "BTS available\n");
 	LOGP(DL1IF, LOGL_DEBUG, " mcc=%x\n", info_ind->mcc);
diff --git a/src/pcu_main.cpp b/src/pcu_main.cpp
index c0dac14..8631ad3 100644
--- a/src/pcu_main.cpp
+++ b/src/pcu_main.cpp
@@ -56,7 +56,6 @@  static void print_help()
 			"provided by BTS\n"
 		"  -r   --realtime PRIO Use SCHED_RR with the specified "
 			"priority\n"
-		"  -e   --exit		Exit the application on disconnect\n"
 		);
 }
 
@@ -105,7 +104,7 @@  static void handle_options(int argc, char **argv)
 			rt_prio = atoi(optarg);
 			break;
 		case 'e':
-			gprs_bssgp_exit_on_destroy();
+			fprintf(stderr, "Warning: Option '-e' is deprecated!\n");
 			break;
 		default:
 			fprintf(stderr, "Unknown option '%c'\n", c);
diff --git a/src/sysmo_sock.cpp b/src/sysmo_sock.cpp
index 2e2d9d3..951653e 100644
--- a/src/sysmo_sock.cpp
+++ b/src/sysmo_sock.cpp
@@ -112,12 +112,8 @@  static void pcu_sock_close(struct pcu_sock_state *state, int lost)
 		gprs_rlcmac_tbf::free_all(&bts->trx[trx]);
 	}
 
-	gprs_bssgp_destroy_or_exit();
-
-	if (lost) {
-		state->timer.cb = pcu_sock_timeout;
-		osmo_timer_schedule(&state->timer, 5, 0);
-	}
+	gprs_bssgp_destroy();
+	exit(0);
 }
 
 static int pcu_sock_read(struct osmo_fd *bfd)