| 104 | } |
| 105 | |
| 106 | TUdpHttpResponse::TUdpHttpResponse(TAutoPtr<TRequest>& dataHolder, const TGUID& reqId, const TUdpAddress& peerAddr, EResult result, const char* error) |
| 107 | : TUdpHttpMessage(reqId, peerAddr) |
| 108 | , Ok(result) |
| 109 | { |
| 110 | if (result == TUdpHttpResponse::FAILED) { |
| 111 | Error = error ? error : "request failed"; |
| 112 | } else if (result == TUdpHttpResponse::CANCELED) { |
| 113 | Error = error ? error : "request cancelled"; |
| 114 | } else { |
| 115 | TBlockChainIterator reqData(dataHolder->Data->GetChain()); |
| 116 | if (Y_UNLIKELY(reqData.HasFailed())) { |
| 117 | Y_ASSERT(0 && "wrong format, memory corruption suspected"); |
| 118 | Ok = TUdpHttpResponse::FAILED; |
| 119 | Data.clear(); |
| 120 | Error = "wrong response format"; |
| 121 | } else { |
| 122 | char pktType; |
| 123 | reqData.Read(&pktType, 1); |
| 124 | TGUID guid; |
| 125 | reqData.Read(&guid, sizeof(guid)); |
| 126 | Y_ASSERT(ReqId == guid); |
| 127 | if (pktType == PKT_RESPONSE) { |
| 128 | ReadArr<TString>(&reqData, &Data); |
| 129 | } else if (pktType == PKT_LOCAL_RESPONSE) { |
| 130 | ReadShm(dataHolder->Data->GetSharedData(), &Data); |
| 131 | } else { |
| 132 | Y_ASSERT(0); |
| 133 | } |
| 134 | } |
| 135 | } |
| 136 | } |
| 137 | |
| 138 | class TUdpHttp: public IRequester { |
| 139 | enum EDir { |
nothing calls this directly
no test coverage detected