some socket mntn

Signed-off-by: 李帅 <leo.lishuai@huawei.com>
This commit is contained in:
李帅 2024-09-28 22:03:24 +08:00
parent 8bc0cff5a5
commit ee40498aee
4 changed files with 8 additions and 3 deletions

View File

@ -938,6 +938,10 @@ void PrintLogEx(const char *functionName, int line, uint8_t logLevel, const char
}
int ret = Base::WriteToFd(fd, pDynBuf, bufLen);
delete[] pDynBuf;
if (ret <= 0) {
hdc_strerrno(buf);
WRITE_LOG(LOG_WARN, "SendToPollFd, send %d bytes to fd %d failed [%d][%s]", bufLen, fd, ret, buf);
}
return ret;
}

View File

@ -480,7 +480,7 @@ void HdcChannelBase::FreeChannelOpeate(uv_timer_t *handle)
bool ret = thisClass->ChannelSendSessionCtrlMsg(ctrl, hChannel->targetSessionId);
if (!ret) {
WRITE_LOG(LOG_WARN, "FreeChannelOpeate deatch failed channelId:%u sid:%u",
hChannel->channelId, hChannel->targetSessionId);
hChannel->channelId, hChannel->targetSessionId);
}
auto callbackCheckFreeChannelContinue = [](uv_timer_t *handle) -> void {
HChannel hChannel = (HChannel)handle->data;

View File

@ -243,7 +243,7 @@ struct HdcSession {
std::mutex mapTaskMutex;
AuthVerifyType verifyType;
std::atomic<bool> isNeedDropData; // host: Whether to discard the USB data after it is read
std::atomic<uint32_t> dropBytes;
std::atomic<uint64_t> dropBytes;
bool isSoftReset; // for daemon, Used to record whether a reset command has been received
HdcSessionStat stat;

View File

@ -746,6 +746,7 @@ HSession HdcHostUSB::ConnectDetectDaemon(const HSession hSession, const HDaemonI
}
UpdateUSBDaemonInfo(hUSB, hSession, STATUS_CONNECTED);
hSession->isNeedDropData = true;
hSession->dropBytes = 0;
WRITE_LOG(LOG_INFO, "ConnectDetectDaemon set isNeedDropData true, sid:%u", hSession->sessionId);
BeginUsbRead(hSession);
hUSB->usbMountPoint = pdi->usbMountPoint;
@ -762,7 +763,7 @@ HSession HdcHostUSB::ConnectDetectDaemon(const HSession hSession, const HDaemonI
auto ctrl = pServer->BuildCtrlString(SP_START_SESSION, 0, nullptr, 0);
hSession->isNeedDropData = false;
WRITE_LOG(LOG_INFO, "funcDelayStartSessionNotify set isNeedDropData false, sid:%u drop %u bytes data",
hSession->sessionId, uint32_t(hSession->dropBytes));
hSession->sessionId, uint64_t(hSession->dropBytes));
Base::SendToPollFd(hSession->ctrlFd[STREAM_MAIN], ctrl.data(), ctrl.size());
};