Skip to content
This repository has been archived by the owner on Nov 11, 2024. It is now read-only.

Commit

Permalink
Hopefully fix issue where the registration status callback was not be…
Browse files Browse the repository at this point in the history
…ing called on re-connect of PPP.
  • Loading branch information
RobMeades committed Sep 24, 2024
1 parent cfd6cf6 commit 49390b2
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions cell/src/u_cell_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ static void setNetworkStatus(uCellPrivateInstance_t *pInstance,
uCellNetRegistationStatus_t *pStatus;
bool printAllowed = true;
uCellNetRat_t previousRat = pInstance->rat[regType];
bool forceRegistrationStatusCallback = false;
#if U_CFG_OS_CLIB_LEAKS
// If we're in a URC and the C library leaks memory
// when printf() is called from a dynamically
Expand Down Expand Up @@ -451,6 +452,12 @@ static void setNetworkStatus(uCellPrivateInstance_t *pInstance,
activateContextCallback, pInstance);
}
pInstance->profileState = U_CELL_PRIVATE_PROFILE_STATE_SHOULD_BE_UP;
// After having successfully re-registered we can end up
// falling into the logic below concerning the order of
// +CxREG URCs, when in fact we really _must_ call the
// users registration callback in this case, they need to
// know. Hence we force it to be caleld.
forceRegistrationStatusCallback = true;
}
}

Expand Down Expand Up @@ -478,12 +485,13 @@ static void setNetworkStatus(uCellPrivateInstance_t *pInstance,
// the user we're not registered when we are, so don't call the
// callback for a "not registered" +CGREG/+CEREG if there is still
// a "registered" +CGREG/+CEREG.
if (((regType == U_CELL_PRIVATE_NET_REG_TYPE_CGREG) &&
!U_CELL_NET_STATUS_MEANS_REGISTERED(pInstance->networkStatus[U_CELL_PRIVATE_NET_REG_TYPE_CGREG]) &&
U_CELL_NET_STATUS_MEANS_REGISTERED(pInstance->networkStatus[U_CELL_PRIVATE_NET_REG_TYPE_CEREG])) ||
((regType == U_CELL_PRIVATE_NET_REG_TYPE_CEREG) &&
!U_CELL_NET_STATUS_MEANS_REGISTERED(pInstance->networkStatus[U_CELL_PRIVATE_NET_REG_TYPE_CEREG]) &&
U_CELL_NET_STATUS_MEANS_REGISTERED(pInstance->networkStatus[U_CELL_PRIVATE_NET_REG_TYPE_CGREG]))) {
if (!forceRegistrationStatusCallback &&
(((regType == U_CELL_PRIVATE_NET_REG_TYPE_CGREG) &&
!U_CELL_NET_STATUS_MEANS_REGISTERED(pInstance->networkStatus[U_CELL_PRIVATE_NET_REG_TYPE_CGREG]) &&
U_CELL_NET_STATUS_MEANS_REGISTERED(pInstance->networkStatus[U_CELL_PRIVATE_NET_REG_TYPE_CEREG])) ||
((regType == U_CELL_PRIVATE_NET_REG_TYPE_CEREG) &&
!U_CELL_NET_STATUS_MEANS_REGISTERED(pInstance->networkStatus[U_CELL_PRIVATE_NET_REG_TYPE_CEREG]) &&
U_CELL_NET_STATUS_MEANS_REGISTERED(pInstance->networkStatus[U_CELL_PRIVATE_NET_REG_TYPE_CGREG])))) {
// We remain registered on a PS domain, nothing more to do
} else {
pStatus = (uCellNetRegistationStatus_t *) pUPortMalloc(sizeof(*pStatus));
Expand Down

0 comments on commit 49390b2

Please sign in to comment.