| 937 | } |
| 938 | |
| 939 | bool TUdpHost::ParseDataPacketHeader(const char* header, const char* headerEnd, TTransfer* transfer, int* packetId) { |
| 940 | EUdpCmd cmd; |
| 941 | ui8 originalCmd; |
| 942 | if (ReadBasicPacketHeader(&header, headerEnd, &cmd, &originalCmd)) { |
| 943 | TGUID connectionGuid, thatSideGuid; |
| 944 | TConnectionSettings settings; |
| 945 | TOptionsVector opt; |
| 946 | if (IsDataCmd(cmd) && ReadInConnectionPacketHeaderTail(&header, headerEnd, originalCmd, &connectionGuid, &thatSideGuid, &settings, &opt)) { |
| 947 | ui64 transferId; |
| 948 | if (ReadTransferHeader(&header, headerEnd, &transferId, opt)) { |
| 949 | int ackTos; |
| 950 | ui8 netlibaColor; |
| 951 | if (ReadPacketHeaderTail(&header, headerEnd, packetId, &ackTos, &netlibaColor, opt)) { |
| 952 | // hash map find only if everything else is OK |
| 953 | if (const TIntrusivePtr<IConnection>* connection = Connections.FindPtr(connectionGuid)) { |
| 954 | transfer->Connection = *connection; |
| 955 | transfer->Id = transferId; |
| 956 | return true; |
| 957 | } |
| 958 | } |
| 959 | } |
| 960 | } |
| 961 | } |
| 962 | return false; |
| 963 | } |
| 964 | |
| 965 | void TUdpHost::FailTransfersForConnection(TConnection* connection) { |
| 966 | for (TSendTransfers::TIdIterator i = connection->GetSendQueue().Begin(); i != connection->GetSendQueue().End();) { |
nothing calls this directly
no test coverage detected