diff options
author | Harald Welte <laforge@gnumonks.org> | 2009-02-19 03:11:13 +0000 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2009-02-19 03:11:13 +0000 |
commit | f80b7d347c0449034f48152f25ae972aaaae8a9e (patch) | |
tree | b8f2103e50076a4be493118041832e7cbefbd3d7 | |
parent | fb81ae9da2a35b1359a4c810733bac11519e09e1 (diff) |
bs11_config: makes sure we disconnect properly before exiting
-rw-r--r-- | src/bs11_config.c | 10 | ||||
-rw-r--r-- | src/rs232.c | 5 |
2 files changed, 13 insertions, 2 deletions
diff --git a/src/bs11_config.c b/src/bs11_config.c index bb1539173..1e980c94f 100644 --- a/src/bs11_config.c +++ b/src/bs11_config.c @@ -421,7 +421,7 @@ static int handle_state_resp(enum abis_bs11_phase state) case BS11_STATE_MAINTENANCE: if (command) { if (!strcmp(command, "disconnect")) - exit(0); + abis_nm_bs11_factory_logon(g_bts, 0); else if (!strcmp(command, "reconnect")) rc = abis_nm_bs11_bsc_disconnect(g_bts, 1); else if (!strcmp(command, "software") @@ -438,9 +438,13 @@ static int handle_state_resp(enum abis_bs11_phase state) } else if (!strcmp(command, "delete-trx1")) { abis_nm_bs11_delete_object(g_bts, BS11_OBJ_BBSIG, 1); abis_nm_bs11_delete_object(g_bts, BS11_OBJ_PA, 1); + sleep(5); + abis_nm_bs11_factory_logon(g_bts, 0); command = NULL; } else if (!strcmp(command, "create-trx1")) { create_trx1(g_bts); + sleep(5); + abis_nm_bs11_factory_logon(g_bts, 0); command = NULL; } else if (!strcmp(command, "restart")) { abis_nm_bs11_restart(g_bts); @@ -451,7 +455,7 @@ static int handle_state_resp(enum abis_bs11_phase state) case BS11_STATE_NORMAL: if (command) { if (!strcmp(command, "reconnect")) - exit(0); + abis_nm_bs11_factory_logon(g_bts, 0); else if (!strcmp(command, "disconnect")) abis_nm_bs11_bsc_disconnect(g_bts, 0); else if (!strcmp(command, "query")) { @@ -460,6 +464,8 @@ static int handle_state_resp(enum abis_bs11_phase state) abis_nm_bs11_get_oml_tei_ts(g_bts); abis_nm_bs11_get_trx_power(&g_bts->trx[0]); abis_nm_bs11_get_trx_power(&g_bts->trx[1]); + sleep(5); + abis_nm_bs11_factory_logon(g_bts, 0); command = NULL; } } else if (param_disconnect) { diff --git a/src/rs232.c b/src/rs232.c index 90e881830..92e2e9b23 100644 --- a/src/rs232.c +++ b/src/rs232.c @@ -50,6 +50,8 @@ static struct serial_handle _ser_handle, *ser_handle = &_ser_handle; #define LAPD_HDR_LEN 10 +static int handle_ser_write(struct bsc_fd *bfd); + /* callback from abis_nm */ int _abis_nm_sendmsg(struct msgb *msg) { @@ -78,6 +80,9 @@ int _abis_nm_sendmsg(struct msgb *msg) msgb_enqueue(&sh->tx_queue, msg); sh->fd.when |= BSC_FD_WRITE; + /* we try to immediately send */ + handle_ser_write(&sh->fd); + return 0; } |