void avtDataObjectSource::CheckAbort(void) { if (abortCallback != NULL) { if (abortCallback(abortCallbackArgs)) { EXCEPTION0(AbortException); } } }
int SimpleDMR::onAction(const ServiceDecl *serviceDecl, const ActionDecl *actionDecl, AbortableTask *task, const FrontEnd::InterfaceContext *ifctx, const FrontEnd::RequestContext& reqCtx, const NPT_HttpRequest *req, const NPT_List<NPT_String>& inputArgNames, const NPT_List<NPT_String>& inputArgValues, NPT_List<NPT_String>& outputArgValues) { WriteLocker locker(m_stateLock); if (NPT_String::Compare(serviceDecl->serviceId, "urn:upnp-org:serviceId:AVTransport") == 0) { if (NPT_String::Compare(actionDecl->name, "SetAVTransportURI") == 0) { if (inputArgValues.GetItemCount() != 3) { // Invalid Args return 402; } if (inputArgValues.GetFirstItem()->Compare("0") != 0) { // Invalid InstanceID return 718; } NPT_HttpClient httpClient; NPT_HttpRequest req(*inputArgValues.GetItem(1), NPT_HTTP_METHOD_GET, NPT_HTTP_PROTOCOL_1_1); Helper::setupHttpRequest(req); NPT_HttpResponse *resp; NPT_Result nr; HttpClientAbortCallback abortCallback(&httpClient); if (task->registerAbortCallback(&abortCallback)) { nr = httpClient.SendRequest(req, resp); task->unregisterAbortCallback(&abortCallback); } else { return 715; } if (NPT_FAILED(nr)) { return 716; } PtrHolder<NPT_HttpResponse> resp1(resp); if (resp->GetStatusCode() != 200) { return 716; } NPT_HttpHeader *hdrContentType = resp->GetHeaders().GetHeader(NPT_HTTP_HEADER_CONTENT_TYPE); if (!hdrContentType) { return 714; } setVar(DMRVAR_AVTransportURI, *inputArgValues.GetItem(1)); setVar(DMRVAR_AVTransportURIMetaData, *inputArgValues.GetItem(2)); setVar(DMRVAR_CurrentTrackMetaData, *inputArgValues.GetItem(2)); m_callback->doDmrOpen(this, *inputArgValues.GetItem(1), hdrContentType->GetValue(), *inputArgValues.GetItem(2)); return 0; } if (NPT_String::Compare(actionDecl->name, "GetMediaInfo") == 0) { if (inputArgValues.GetItemCount() != 1) { // Invalid Args return 402; } if (inputArgValues.GetFirstItem()->Compare("0") != 0) { // Invalid InstanceID return 718; } *outputArgValues.GetItem(0) = m_avtVars[DMRVAR_NumberOfTracks - DMRVAR_BaseIndexAVT]; *outputArgValues.GetItem(1) = m_avtVars[DMRVAR_CurrentMediaDuration - DMRVAR_BaseIndexAVT]; *outputArgValues.GetItem(2) = m_avtVars[DMRVAR_AVTransportURI - DMRVAR_BaseIndexAVT]; *outputArgValues.GetItem(3) = m_avtVars[DMRVAR_AVTransportURIMetaData - DMRVAR_BaseIndexAVT]; *outputArgValues.GetItem(4) = m_avtVars[DMRVAR_NextAVTransportURI - DMRVAR_BaseIndexAVT]; *outputArgValues.GetItem(5) = m_avtVars[DMRVAR_NextAVTransportURIMetaData - DMRVAR_BaseIndexAVT]; *outputArgValues.GetItem(6) = m_avtVars[DMRVAR_PlaybackStorageMedium - DMRVAR_BaseIndexAVT]; *outputArgValues.GetItem(7) = m_avtVars[DMRVAR_RecordStorageMedium - DMRVAR_BaseIndexAVT]; *outputArgValues.GetItem(8) = m_avtVars[DMRVAR_RecordMediumWriteStatus - DMRVAR_BaseIndexAVT]; return 0; } if (NPT_String::Compare(actionDecl->name, "GetTransportInfo") == 0) { if (inputArgValues.GetItemCount() != 1) { // Invalid Args return 402; } if (inputArgValues.GetFirstItem()->Compare("0") != 0) { // Invalid InstanceID return 718; } *outputArgValues.GetItem(0) = m_avtVars[DMRVAR_TransportState - DMRVAR_BaseIndexAVT]; *outputArgValues.GetItem(1) = m_avtVars[DMRVAR_TransportStatus - DMRVAR_BaseIndexAVT]; *outputArgValues.GetItem(2) = m_avtVars[DMRVAR_TransportPlaySpeed - DMRVAR_BaseIndexAVT]; return 0; } if (NPT_String::Compare(actionDecl->name, "GetPositionInfo") == 0) { if (inputArgValues.GetItemCount() != 1) { // Invalid Args return 402; } if (inputArgValues.GetFirstItem()->Compare("0") != 0) { // Invalid InstanceID return 718; } *outputArgValues.GetItem(0) = m_avtVars[DMRVAR_CurrentTrack - DMRVAR_BaseIndexAVT]; *outputArgValues.GetItem(1) = m_avtVars[DMRVAR_CurrentTrackDuration - DMRVAR_BaseIndexAVT]; *outputArgValues.GetItem(2) = m_avtVars[DMRVAR_CurrentTrackMetaData - DMRVAR_BaseIndexAVT]; *outputArgValues.GetItem(3) = m_avtVars[DMRVAR_CurrentTrackURI - DMRVAR_BaseIndexAVT]; *outputArgValues.GetItem(4) = m_avtVars[DMRVAR_RelativeTimePosition - DMRVAR_BaseIndexAVT]; *outputArgValues.GetItem(5) = m_avtVars[DMRVAR_AbsoluteTimePosition - DMRVAR_BaseIndexAVT]; *outputArgValues.GetItem(6) = m_avtVars[DMRVAR_RelativeCounterPosition - DMRVAR_BaseIndexAVT]; *outputArgValues.GetItem(7) = m_avtVars[DMRVAR_AbsoluteCounterPosition - DMRVAR_BaseIndexAVT]; return 0; } if (NPT_String::Compare(actionDecl->name, "GetDeviceCapabilities") == 0) { if (inputArgValues.GetItemCount() != 1) { // Invalid Args return 402; } if (inputArgValues.GetFirstItem()->Compare("0") != 0) { // Invalid InstanceID return 718; } *outputArgValues.GetItem(0) = m_avtVars[DMRVAR_PossiblePlaybackStorageMedia - DMRVAR_BaseIndexAVT]; *outputArgValues.GetItem(1) = m_avtVars[DMRVAR_PossibleRecordStorageMedia - DMRVAR_BaseIndexAVT]; *outputArgValues.GetItem(2) = m_avtVars[DMRVAR_PossibleRecordQualityModes - DMRVAR_BaseIndexAVT]; return 0; } if (NPT_String::Compare(actionDecl->name, "GetTransportSettings") == 0) { if (inputArgValues.GetItemCount() != 1) { // Invalid Args return 402; } if (inputArgValues.GetFirstItem()->Compare("0") != 0) { // Invalid InstanceID return 718; } *outputArgValues.GetItem(0) = m_avtVars[DMRVAR_CurrentPlayMode - DMRVAR_BaseIndexAVT]; *outputArgValues.GetItem(1) = m_avtVars[DMRVAR_CurrentRecordQualityMode - DMRVAR_BaseIndexAVT]; return 0; } if (NPT_String::Compare(actionDecl->name, "Stop") == 0) { m_callback->doDmrStop(this); return 0; } if (NPT_String::Compare(actionDecl->name, "Play") == 0) { m_callback->doDmrPlay(this); return 0; } if (NPT_String::Compare(actionDecl->name, "Pause") == 0) { m_callback->doDmrPause(this); return 0; } if (NPT_String::Compare(actionDecl->name, "Seek") == 0) { if (inputArgValues.GetItemCount() != 3) { // Invalid Args return 402; } if (inputArgValues.GetFirstItem()->Compare("0") != 0) { // Invalid InstanceID return 718; } const NPT_String& seekMode = *inputArgValues.GetItem(1); const NPT_String& seekTarget = *inputArgValues.GetItem(2); if (seekMode.Compare("TRACK_NR") == 0) { // TODO: } else if (seekMode.Compare("REL_TIME") == 0) { NPT_UInt64 pos; if (NPT_FAILED(Helper::parseTrackDurationString(seekTarget, pos))) { // Illegal seek target return 711; } m_callback->doDmrSeekTo(this, pos); } else { // Seek mode not supported return 710; } return 0; } if (NPT_String::Compare(actionDecl->name, "Next") == 0) { return 0; } if (NPT_String::Compare(actionDecl->name, "Previous") == 0) { return 0; } return 602; } if (NPT_String::Compare(serviceDecl->serviceId, "urn:upnp-org:serviceId:RenderingControl") == 0) { if (NPT_String::Compare(actionDecl->name, "ListPresets") == 0) { if (inputArgValues.GetItemCount() != 1) { // Invalid Args return 402; } if (inputArgValues.GetFirstItem()->Compare("0") != 0) { // Invalid InstanceID return 702; } *outputArgValues.GetItem(0) = m_rcsVars[DMRVAR_PresetNameList - DMRVAR_BaseIndexRCS]; return 0; } if (NPT_String::Compare(actionDecl->name, "SelectPreset") == 0) { return 0; } if (NPT_String::Compare(actionDecl->name, "GetMute") == 0) { if (inputArgValues.GetItemCount() != 2) { // Invalid Args return 402; } if (inputArgValues.GetFirstItem()->Compare("0") != 0) { // Invalid InstanceID return 702; } *outputArgValues.GetItem(0) = m_rcsVars[DMRVAR_Mute - DMRVAR_BaseIndexRCS]; return 0; } if (NPT_String::Compare(actionDecl->name, "SetMute") == 0) { if (inputArgValues.GetItemCount() != 3) { // Invalid Args return 402; } if (inputArgValues.GetFirstItem()->Compare("0") != 0) { // Invalid InstanceID return 702; } const NPT_String& desiredMute = *inputArgValues.GetItem(2); m_callback->doDmrSetMute(this, desiredMute.Compare("true", true) == 0 || desiredMute.Compare("1") == 0); return 0; } if (NPT_String::Compare(actionDecl->name, "GetVolume") == 0) { if (inputArgValues.GetItemCount() != 2) { // Invalid Args return 402; } if (inputArgValues.GetFirstItem()->Compare("0") != 0) { // Invalid InstanceID return 702; } *outputArgValues.GetItem(0) = m_rcsVars[DMRVAR_Volume - DMRVAR_BaseIndexRCS]; return 0; } if (NPT_String::Compare(actionDecl->name, "SetVolume") == 0) { if (inputArgValues.GetItemCount() != 3) { // Invalid Args return 402; } if (inputArgValues.GetFirstItem()->Compare("0") != 0) { // Invalid InstanceID return 702; } const NPT_String& desiredVolume = *inputArgValues.GetItem(2); int volume; if (NPT_FAILED(NPT_ParseInteger(desiredVolume, volume))) { // Invalid Args return 402; } m_callback->doDmrSetVolume(this, volume); return 0; } return 602; } if (NPT_String::Compare(serviceDecl->serviceId, "urn:upnp-org:serviceId:ConnectionManager") == 0) { if (NPT_String::Compare(actionDecl->name, "GetProtocolInfo") == 0) { NPT_String v; if (getStateValue(serviceDecl->serviceId, "SourceProtocolInfo", v)) { *outputArgValues.GetItem(0) = v; } if (getStateValue(serviceDecl->serviceId, "SinkProtocolInfo", v)) { *outputArgValues.GetItem(1) = v; } return 0; } if (NPT_String::Compare(actionDecl->name, "GetCurrentConnectionIDs") == 0) { NPT_String v; if (getStateValue(serviceDecl->serviceId, "SourceProtocolInfo", v)) { *outputArgValues.GetItem(0) = v; } return 0; } if (NPT_String::Compare(actionDecl->name, "GetCurrentConnectionInfo") == 0) { *outputArgValues.GetItem(0) = "0"; *outputArgValues.GetItem(1) = "0"; *outputArgValues.GetItem(2) = ""; *outputArgValues.GetItem(3) = ""; *outputArgValues.GetItem(4) = "-1"; *outputArgValues.GetItem(5) = "Input"; // or "Output"? WTF! *outputArgValues.GetItem(6) = "OK"; return 0; } return 602; } return 501; }
void serveFile2(AbortableTask *task, const NPT_String& filePath, const NPT_String& mimeType, const FrontEnd::RequestContext& reqCtx, const NPT_HttpRequest *req, NPT_HttpResponse& resp, HttpOutput *httpOutput) { #if 1 NPT_File f(filePath); NPT_FileInfo fileInfo; if (NPT_FAILED(f.GetInfo(fileInfo)) || fileInfo.m_Type != NPT_FileInfo::FILE_TYPE_REGULAR || NPT_FAILED(f.Open(NPT_FILE_OPEN_MODE_READ))) { setStatusCode(resp, 404); httpOutput->writeResponseHeader(resp); return; } NPT_InputStreamReference fileInput; f.GetInputStream(fileInput); serveStream(task, fileInput.AsPointer(), fileInfo.m_ModificationTime, mimeType, reqCtx, req, resp, httpOutput); #else bool isGetMethod = req->GetMethod().Compare("GET") == 0; bool isHeadMethod = req->GetMethod().Compare("HEAD") == 0; if (isGetMethod || isHeadMethod) { NPT_Result nr; NPT_File f(filePath); NPT_FileInfo fileInfo; if (NPT_FAILED(f.GetInfo(fileInfo)) || fileInfo.m_Type != NPT_FileInfo::FILE_TYPE_REGULAR || NPT_FAILED(f.Open(NPT_FILE_OPEN_MODE_READ))) { setStatusCode(resp, 404); httpOutput->writeResponseHeader(resp); return; } NPT_InputStreamReference fileInput; f.GetInputStream(fileInput); NPT_UInt64 offset, length; NPT_HttpHeader *hdrRange = req->GetHeaders().GetHeader("RANGE"); if (hdrRange) { if (!parseRangeHeader(hdrRange->GetValue(), fileInfo.m_Size, offset, length)) { setStatusCode(resp, 416); httpOutput->writeResponseHeader(resp); return; } setStatusCode(resp, 206); resp.GetHeaders().SetHeader(NPT_HTTP_HEADER_CONTENT_RANGE, NPT_String::Format("bytes %s-%s/%s", NPT_String::FromIntegerU(offset).GetChars(), NPT_String::FromIntegerU(offset + length - 1).GetChars(), NPT_String::FromIntegerU(fileInfo.m_Size).GetChars())); fileInput->Seek(offset); } else { offset = 0; length = fileInfo.m_Size; setStatusCode(resp, 200); } resp.GetHeaders().SetHeader(NPT_HTTP_HEADER_CONTENT_TYPE, mimeType); resp.GetHeaders().SetHeader(NPT_HTTP_HEADER_CONTENT_LENGTH, NPT_String::FromIntegerU(length)); resp.GetHeaders().SetHeader("Last-Modified", NPT_DateTime(fileInfo.m_ModificationTime).ToString(NPT_DateTime::FORMAT_RFC_1123)); resp.GetHeaders().SetHeader("Accept-Ranges", "bytes"); resp.GetHeaders().SetHeader("EXT", ""); if (reqCtx.transferMode != FrontEnd::TM_None) { const char *transferMode = "Streaming"; switch (reqCtx.transferMode) { case FrontEnd::TM_Background: transferMode = "Background"; break; case FrontEnd::TM_Interactive: transferMode = "Interactive"; break; } resp.GetHeaders().SetHeader("transferMode.dlna.org", transferMode); } if (reqCtx.getcontentFeaturesReq) { NPT_String contentFeatures("DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01700000000000000000000000000000"); resp.GetHeaders().SetHeader("contentFeatures.dlna.org", contentFeatures); } httpOutput->writeResponseHeader(resp); if (isGetMethod) { bool abortFlag = false; ServeFileAbortCallback abortCallback(&abortFlag); if (task->registerAbortCallback(&abortCallback)) { NPT_DataBuffer buffer(4096); NPT_UInt64 cbRemain = length; for (;;) { if (abortFlag) { break; } if (cbRemain == 0) { break; } NPT_Size cbRead; NPT_UInt64 cbToRead = cbRemain; if (cbToRead > buffer.GetBufferSize()) { cbToRead = buffer.GetBufferSize(); } nr = fileInput->Read(buffer.UseData(), buffer.GetBufferSize(), &cbRead); if (NPT_FAILED(nr)) { /*if (nr == NPT_ERROR_EOS) { } else { }*/ break; } if (abortFlag) { break; } if (cbRead > 0) { cbRemain -= cbRead; httpOutput->writeData(buffer.GetData(), cbRead); } } task->unregisterAbortCallback(&abortCallback); } } } else { setStatusCode(resp, 405); resp.GetHeaders().SetHeader("Allow", "GET, HEAD"); httpOutput->writeResponseHeader(resp); } #endif }
void serveStreamAdv(AbortableTask *task, const MediaStore::FileDetail& detail, AdvStreamReader *reader, const FrontEnd::RequestContext& reqCtx, const NPT_HttpRequest *req, NPT_HttpResponse& resp, HttpOutput *httpOutput, NPT_Size bufferSize) { bool isGetMethod = req->GetMethod().Compare("GET") == 0; bool isHeadMethod = req->GetMethod().Compare("HEAD") == 0; if (isGetMethod || isHeadMethod) { NPT_Result nr; NPT_UInt64 offset, length; NPT_HttpHeader *hdrRange = req->GetHeaders().GetHeader("RANGE"); if (hdrRange) { if (!parseRangeHeader(hdrRange->GetValue(), detail.m_size, offset, length)) { setStatusCode(resp, 416); httpOutput->writeResponseHeader(resp); return; } setStatusCode(resp, 206); resp.GetHeaders().SetHeader(NPT_HTTP_HEADER_CONTENT_RANGE, NPT_String::Format("bytes %s-%s/%s", NPT_String::FromIntegerU(offset).GetChars(), NPT_String::FromIntegerU(offset + length - 1).GetChars(), NPT_String::FromIntegerU(detail.m_size).GetChars())); } else { offset = 0; length = detail.m_size; setStatusCode(resp, 200); } resp.GetHeaders().SetHeader(NPT_HTTP_HEADER_CONTENT_TYPE, detail.m_mimeType); resp.GetHeaders().SetHeader(NPT_HTTP_HEADER_CONTENT_LENGTH, NPT_String::FromIntegerU(length)); resp.GetHeaders().SetHeader("Last-Modified", NPT_DateTime(detail.m_modificationTime).ToString(NPT_DateTime::FORMAT_RFC_1123)); resp.GetHeaders().SetHeader("Accept-Ranges", "bytes"); resp.GetHeaders().SetHeader("EXT", ""); if (reqCtx.transferMode != FrontEnd::TM_None) { const char *transferMode = "Streaming"; switch (reqCtx.transferMode) { case FrontEnd::TM_Background: transferMode = "Background"; break; case FrontEnd::TM_Interactive: transferMode = "Interactive"; break; } resp.GetHeaders().SetHeader("transferMode.dlna.org", transferMode); } if (reqCtx.getcontentFeaturesReq) { NPT_String contentFeatures("DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01700000000000000000000000000000"); resp.GetHeaders().SetHeader("contentFeatures.dlna.org", contentFeatures); } httpOutput->writeResponseHeader(resp); if (isGetMethod) { bool abortFlag = false; ServeFileAbortCallback abortCallback(&abortFlag, reader); if (task->registerAbortCallback(&abortCallback)) { reader->seek(offset); NPT_DataBuffer buffer(bufferSize); NPT_UInt64 cbRemain = length; for (;;) { if (abortFlag) { break; } if (cbRemain == 0) { break; } NPT_Size cbRead; NPT_Size cbToRead = cbRemain; if (cbToRead > buffer.GetBufferSize()) { cbToRead = buffer.GetBufferSize(); } nr = reader->read(buffer.UseData(), buffer.GetBufferSize(), &cbRead); if (NPT_FAILED(nr)) { /*if (nr == NPT_ERROR_EOS) { } else { }*/ break; } if (abortFlag) { break; } if (cbRead > 0) { cbRemain -= cbRead; httpOutput->writeData(buffer.GetData(), cbRead); } } task->unregisterAbortCallback(&abortCallback); } } } else { setStatusCode(resp, 405); resp.GetHeaders().SetHeader("Allow", "GET, HEAD"); httpOutput->writeResponseHeader(resp); } }
void FrontEnd::processSsdpSearch(SsdpServerTask *task, Interface *intf, const NPT_DataBuffer& data, const NPT_SocketAddress& fromAddr) { do { NPT_HttpRequest *req; NPT_InputStreamReference inputStream0(new NPT_MemoryStream(data.GetData(), data.GetDataSize())); NPT_BufferedInputStream inputStream(inputStream0); if (NPT_FAILED(NPT_HttpRequest::Parse(inputStream, NULL, req))) { break; } PtrHolder<NPT_HttpRequest> req1(req); if (req->GetMethod().Compare("M-SEARCH") != 0 || req->GetProtocol().Compare(NPT_HTTP_PROTOCOL_1_1) != 0 || req->GetUrl().GetPath().Compare("*") != 0) { break; } NPT_HttpHeader *hdrMan = req->GetHeaders().GetHeader("MAN"); if (!hdrMan || hdrMan->GetValue().Compare("\"ssdp:discover\"") != 0) { break; } NPT_HttpHeader *hdrHost = req->GetHeaders().GetHeader("HOST"); if (!hdrHost || (hdrHost->GetValue().Compare("239.255.255.250:1900") != 0 && hdrHost->GetValue().Compare("239.255.255.250") != 0)) { break; } int mx; NPT_HttpHeader *hdrMX = req->GetHeaders().GetHeader("MX"); if (!hdrMX || NPT_FAILED(NPT_ParseInteger(hdrMX->GetValue(), mx)) || mx < 1) { break; } if (mx > 120) { mx = 120; } NPT_HttpHeader *hdrST = req->GetHeaders().GetHeader("ST"); if (!hdrST) { break; } NPT_List<MatchContext*> matchList; NPT_UdpSocket sock(NPT_SOCKET_FLAG_CANCELLABLE); sock.Bind(NPT_SocketAddress(intf->m_context.m_ifAddr, 0)); NPT_SharedVariable waitVar; waitVar.SetValue(0); { ReadLocker locker(m_dsLock); for (NPT_Ordinal i = 0; i < m_deviceImplList.GetItemCount(); i++) { NPT_List<DeviceImplInfo*>::Iterator it = m_deviceImplList.GetItem(i); DeviceImplInfo *info = *it; MatchContext *matchContext = new MatchContext(); if (info->m_deviceImpl->match(hdrST->GetValue(), matchContext->matches)) { matchList.Add(matchContext); matchContext->deviceUuid = info->m_deviceImpl->uuid(); matchContext->expireSeconds = info->m_deviceImpl->m_expireSeconds; matchContext->descPath = info->m_deviceImpl->m_descPath; matchContext->httpRoot = info->m_context.m_httpRoot; } else { delete matchContext; } } } SsdpSearchAbortCallback abortCallback(&sock, &waitVar); if (task->registerAbortCallback(&abortCallback)) { for (NPT_Ordinal i = 0; i < matchList.GetItemCount(); i++) { MatchContext *matchContext = *matchList.GetItem(i); NPT_String location = NPT_String::Format("http://%s:%d%s%s", intf->m_context.m_ifAddr.ToString().GetChars(), intf->m_context.m_httpPort, matchContext->httpRoot.GetChars(), matchContext->descPath.GetChars()); bool broken = false; for (NPT_Ordinal j = 0; j < matchContext->matches.GetItemCount(); j++) { NPT_List<DeviceImplMatch>::Iterator it2 = matchContext->matches.GetItem(j); NPT_Timeout timeout = NPT_System::GetRandomInteger() % (mx * 1000); // TODO: wait or not ??? timeout = 0; if (NPT_SUCCEEDED(waitVar.WaitWhileEquals(0, timeout))) { break; } { ReadLocker locker(m_dsLock); if (m_deviceImplIndex.HasKey(matchContext->deviceUuid)) { NPT_TimeStamp ts; NPT_System::GetCurrentTimeStamp(ts); NPT_String dateStr = NPT_DateTime(ts).ToString(NPT_DateTime::FORMAT_RFC_1123); NPT_String resp = NPT_String::Format("HTTP/1.1 200 OK\r\nCACHE-CONTROL: max-age=%d\r\nDATE: %s\r\nEXT: \r\nLOCATION: %s\r\nSERVER: %s\r\nST: %s\r\nUSN: %s\r\nCUSTOM:%s\r\n\r\n", matchContext->expireSeconds, dateStr.GetChars(), location.GetChars(), m_serverHeader.GetChars(), it2->m_st.GetChars(), it2->m_usn.GetChars(), m_DevName.GetChars()); NPT_DataBuffer packet(resp.GetChars(), resp.GetLength(), false); sock.Send(packet, &fromAddr); } } } if (broken) { break; } } task->unregisterAbortCallback(&abortCallback); } matchList.Apply(NPT_ObjectDeleter<MatchContext>()); } while (false); }