| 912 | } |
| 913 | |
| 914 | void srt::CRendezvousQueue::updateConnStatus(EReadStatus rst, EConnectStatus cst, CUnit* unit) |
| 915 | { |
| 916 | vector<LinkStatusInfo> toRemove, toProcess; |
| 917 | |
| 918 | const CPacket* pkt = unit ? &unit->m_Packet : NULL; |
| 919 | |
| 920 | // Need a stub value for a case when there's no unit provided ("storage depleted" case). |
| 921 | // It should be normally NOT IN USE because in case of "storage depleted", rst != RST_OK. |
| 922 | const SRTSOCKET dest_id = pkt ? pkt->id() : 0; |
| 923 | |
| 924 | // If no socket were qualified for further handling, finish here. |
| 925 | // Otherwise toRemove and toProcess contain items to handle. |
| 926 | if (!qualifyToHandle(rst, cst, dest_id, (toRemove), (toProcess))) |
| 927 | return; |
| 928 | |
| 929 | HLOGC(cnlog.Debug, |
| 930 | log << "updateConnStatus: collected " << toProcess.size() << " for processing, " << toRemove.size() |
| 931 | << " to close"); |
| 932 | |
| 933 | // Repeat (resend) connection request. |
| 934 | for (vector<LinkStatusInfo>::iterator i = toProcess.begin(); i != toProcess.end(); ++i) |
| 935 | { |
| 936 | // IMPORTANT INFORMATION concerning changes towards UDT legacy. |
| 937 | // In the UDT code there was no attempt to interpret any incoming data. |
| 938 | // All data from the incoming packet were considered to be already deployed into |
| 939 | // m_ConnRes field, and m_ConnReq field was considered at this time accordingly updated. |
| 940 | // Therefore this procedure did only one thing: craft a new handshake packet and send it. |
| 941 | // In SRT this may also interpret extra data (extensions in case when Agent is Responder) |
| 942 | // and the `pktIn` packet may sometimes contain no data. Therefore the passed `rst` |
| 943 | // must be checked to distinguish the call by periodic update (RST_AGAIN) from a call |
| 944 | // due to have received the packet (RST_OK). |
| 945 | // |
| 946 | // In the below call, only the underlying `processRendezvous` function will be attempting |
| 947 | // to interpret these data (for caller-listener this was already done by `processConnectRequest` |
| 948 | // before calling this function), and it checks for the data presence. |
| 949 | |
| 950 | EReadStatus read_st = rst; |
| 951 | EConnectStatus conn_st = cst; |
| 952 | |
| 953 | CUDTUnited::SocketKeeper sk (CUDT::uglobal(), i->id); |
| 954 | if (!sk.socket) |
| 955 | { |
| 956 | // Socket deleted already, so stop this and proceed to the next loop. |
| 957 | LOGC(cnlog.Error, log << "updateConnStatus: IPE: socket @" << i->id << " already closed, proceed to only removal from lists"); |
| 958 | toRemove.push_back(*i); |
| 959 | continue; |
| 960 | } |
| 961 | |
| 962 | |
| 963 | if (cst != CONN_RENDEZVOUS && dest_id != 0) |
| 964 | { |
| 965 | if (i->id != dest_id) |
| 966 | { |
| 967 | HLOGC(cnlog.Debug, log << "updateConnStatus: cst=" << ConnectStatusStr(cst) << " but for RID @" << i->id |
| 968 | << " dest_id=@" << dest_id << " - resetting to AGAIN"); |
| 969 | |
| 970 | read_st = RST_AGAIN; |
| 971 | conn_st = CONN_AGAIN; |
no test coverage detected