Handle the few cases for a TBF that does not have channels assigned to its MS yet.
| 1128 | // Handle the few cases for a TBF that does not have channels |
| 1129 | // assigned to its MS yet. |
| 1130 | void TBF::mtServiceUnattached() |
| 1131 | { |
| 1132 | // Dead tbfs are attached, so dont test this flag. |
| 1133 | //if (mtAttached) return; |
| 1134 | switch (mtState) { |
| 1135 | case TBFState::Unused: |
| 1136 | // This state may occur legally during testing. |
| 1137 | GLOG(ERR) << "GPRS found TBF with uninitialized state\n"; |
| 1138 | // Fix it so we wont see this message again. |
| 1139 | mtCancel(MSStopCause::CauseUnknown, TbfNoRetry); |
| 1140 | //mtState = TBFState::Dead; |
| 1141 | return; |
| 1142 | case TBFState::DataReadyToConnect: |
| 1143 | if (mtAttach()) { |
| 1144 | mtSetState(TBFState::DataWaiting1); |
| 1145 | } |
| 1146 | return; |
| 1147 | case TBFState::Deleting: |
| 1148 | casedeleting: |
| 1149 | if (mtMsgPending()) { |
| 1150 | // Wait until the response must have been received, |
| 1151 | // to make sure it gets delivered to the right TBF. |
| 1152 | // This is overkill - whoever put this in Deleting state already did this. |
| 1153 | return; |
| 1154 | } |
| 1155 | mtDelete(); // Cleans up and deletes. |
| 1156 | return; |
| 1157 | case TBFState::Dead: |
| 1158 | // A dead TBF is normally still "attached", ie, hanging onto its resources |
| 1159 | // to prevent someone else from using them, until its killtime expires. |
| 1160 | // But the MS may lose its channel assignment (eg, due to RACH) |
| 1161 | // so this case may not be handled by the attached tbf code. |
| 1162 | devassert(mtDeadTime.valid()); |
| 1163 | if (mtDeadTime.expired()) { mtDetach(); goto casedeleting; } |
| 1164 | return; |
| 1165 | default:return; |
| 1166 | } |
| 1167 | } |
| 1168 | |
| 1169 | // Generic check for non-reponsive ms before sending another message. |
| 1170 | // If we have sent the same message more than a specified number of times, |
no test coverage detected