Reconnection from paging and IDLE working. Reselecting cell when turning off working

master
Ismael Gomez 7 years ago
parent cc28aebced
commit 0d099a132b

@ -248,9 +248,8 @@ void gw::run_thread()
return; return;
} }
const static uint32_t ATTACH_TIMEOUT_S = 4; const static uint32_t ATTACH_WAIT_TOUT = 40; // 4 sec
const static uint32_t ATTACH_MAX_ATTEMPTS = 3; uint32_t attach_wait = 0;
uint32_t attach_attempts = 0;
gw_log->info("GW IP packet receiver thread run_enable\n"); gw_log->info("GW IP packet receiver thread run_enable\n");
@ -277,21 +276,19 @@ void gw::run_thread()
{ {
gw_log->info_hex(pdu->msg, pdu->N_bytes, "TX PDU"); gw_log->info_hex(pdu->msg, pdu->N_bytes, "TX PDU");
while(run_enable && !pdcp->is_drb_enabled(cfg.lcid) && attach_attempts < ATTACH_MAX_ATTEMPTS) { while(run_enable && !pdcp->is_drb_enabled(cfg.lcid) && attach_wait < ATTACH_WAIT_TOUT) {
gw_log->info("LCID=%d not active, requesting NAS attach (%d/%d)\n", cfg.lcid, attach_attempts, ATTACH_MAX_ATTEMPTS); if (!attach_wait) {
gw_log->info("LCID=%d not active, requesting NAS attach (%d/%d)\n", cfg.lcid, attach_wait, ATTACH_WAIT_TOUT);
if (!nas->attach_request()) { if (!nas->attach_request()) {
attach_attempts++; gw_log->console("Could not re-establish the connection\n");
sleep(ATTACH_TIMEOUT_S); break;
} else {
attach_attempts = 0;
} }
} }
usleep(100000);
if (attach_attempts == ATTACH_MAX_ATTEMPTS) { attach_wait++;
gw_log->warning("LCID=%d was not active after %d attempts\n", cfg.lcid, ATTACH_MAX_ATTEMPTS);
} }
attach_attempts = 0; attach_wait = 0;
if (!run_enable) { if (!run_enable) {
break; break;

@ -152,6 +152,7 @@ bool nas::attach_request() {
nas_log->info("NAS is already registered but RRC disconnected. Connecting now...\n"); nas_log->info("NAS is already registered but RRC disconnected. Connecting now...\n");
if (rrc_connect()) { if (rrc_connect()) {
nas_log->info("NAS attached successfully.\n"); nas_log->info("NAS attached successfully.\n");
return true;
} else { } else {
nas_log->error("Could not attach\n"); nas_log->error("Could not attach\n");
} }

Loading…
Cancel
Save