mirror of
https://gitee.com/openharmony/developtools_hdc
synced 2024-11-27 09:11:24 +00:00
some socket mntn
Signed-off-by: 李帅 <leo.lishuai@huawei.com>
This commit is contained in:
parent
6e6bd02cbb
commit
3ec7ed0523
@ -1879,9 +1879,6 @@ void PrintLogEx(const char *functionName, int line, uint8_t logLevel, const char
|
||||
uint8_t version = (HDC_VERSION_NUMBER << 12 >> 24) & 0xff;
|
||||
uint8_t fix = (HDC_VERSION_NUMBER << 20 >> 28) & 0xff; // max 16, tail is p
|
||||
string ver = StringFormat("%x.%x.%x%c", major, minor, version, a + fix);
|
||||
#ifndef IS_RELEASE_VERSION
|
||||
ver += " for ide mac test only 2 ";
|
||||
#endif
|
||||
return "Ver: " + ver;
|
||||
}
|
||||
|
||||
|
@ -487,11 +487,6 @@ void HdcChannelBase::FreeChannelOpeate(uv_timer_t *handle)
|
||||
if (!hChannel->childCleared) {
|
||||
WRITE_LOG(LOG_WARN, "FreeChannelOpeate childCleared:%d channelId:%u sid:%u",
|
||||
hChannel->childCleared, hChannel->channelId, hChannel->targetSessionId);
|
||||
// auto ctrl = HdcSessionBase::BuildCtrlString(SP_DEATCH_CHANNEL, hChannel->channelId, nullptr, 0);
|
||||
// bool ret = thisClass->ChannelSendSessionCtrlMsg(ctrl, hChannel->targetSessionId);
|
||||
// if (!ret) {
|
||||
// WRITE_LOG(LOG_WARN, "FreeChannelOpeate deatch failed channelId:%u sid:%u", hChannel->channelId, hChannel->targetSessionId);
|
||||
// }
|
||||
return;
|
||||
}
|
||||
Base::TryCloseHandle((uv_handle_t *)handle, Base::CloseTimerCallback);
|
||||
|
@ -190,8 +190,9 @@ struct HdcUART {
|
||||
using HUART = struct HdcUART *;
|
||||
#endif
|
||||
struct HdcSessionStat {
|
||||
// send/recv bytes for dataPipe/dataFd
|
||||
// bytes successed send to hSession->dataFd[STREAM_MAIN]
|
||||
std::atomic<uint64_t> dataSendBytes;
|
||||
// bytes successed read from hSession->dataPipe[STREAM_WORK]
|
||||
std::atomic<uint64_t> dataRecvBytes;
|
||||
};
|
||||
|
||||
|
@ -644,7 +644,9 @@ void HdcSessionBase::FreeSession(const uint32_t sessionId)
|
||||
WRITE_LOG(LOG_WARN, "FreeSession hSession nullptr or isDead sessionId:%u", sessionId);
|
||||
break;
|
||||
}
|
||||
WRITE_LOG(LOG_INFO, "dataFdSend:%llu, dataFdRecv:%llu", uint64_t(hSession->stat.dataSendBytes), uint64_t(hSession->stat.dataRecvBytes));
|
||||
WRITE_LOG(LOG_INFO, "dataFdSend:%llu, dataFdRecv:%llu",
|
||||
uint64_t(hSession->stat.dataSendBytes),
|
||||
uint64_t(hSession->stat.dataRecvBytes));
|
||||
hSession->isDead = true;
|
||||
Base::TimerUvTask(&loopMain, hSession, FreeSessionOpeate);
|
||||
NotifyInstanceSessionFree(hSession, false);
|
||||
|
@ -467,6 +467,8 @@ int HdcHostUSB::UsbToHdcProtocol(uv_stream_t *stream, uint8_t *appendData, int d
|
||||
int index = 0;
|
||||
int childRet = 0;
|
||||
int retryTimes = 0;
|
||||
const int maxRetryTimes = 3;
|
||||
const int oneSecond = 1;
|
||||
|
||||
while (index < dataSize) {
|
||||
fd_set fdSet;
|
||||
@ -482,11 +484,12 @@ int HdcHostUSB::UsbToHdcProtocol(uv_stream_t *stream, uint8_t *appendData, int d
|
||||
#else
|
||||
strerror_r(errno, buf, bufSize);
|
||||
#endif
|
||||
WRITE_LOG(LOG_FATAL, "select error:%d [%s][%d] retryTimes %d", errno, buf, childRet, retryTimes);
|
||||
WRITE_LOG(LOG_FATAL, "select error:%d [%s][%d] retry times %d alread send %d bytes, total %d bytes",
|
||||
errno, buf, childRet, retryTimes, index, dataSize);
|
||||
Base::DispUvStreamInfo(stream, "hostusb select failed");
|
||||
if (retryTimes < 3) {
|
||||
if (retryTimes < maxRetryTimes) {
|
||||
retryTimes++;
|
||||
sleep(1);
|
||||
sleep(oneSecond);
|
||||
continue;
|
||||
} else {
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user