mirror of
https://gitee.com/openharmony/developtools_hdc
synced 2025-02-22 04:01:36 +00:00
update src/common/transfer.cpp.
Signed-off-by: liupeng298 <liupeng298@huawei.com>
This commit is contained in:
parent
85ec1ed028
commit
70c6d52ab2
@ -41,7 +41,7 @@ HdcTransferBase::~HdcTransferBase()
|
||||
taskInfo->channelId, ctxNow.lastErrno, ctxNow.fsOpenReq.result, ctxNow.ioFinish);
|
||||
|
||||
if (ctxNow.lastErrno != 0 || (ctxNow.fsOpenReq.result > 0 && !ctxNow.ioFinish)) {
|
||||
CloseFd(&ctxNow, ctxNow.fsOpenReq.result);
|
||||
CloseFd(ctxNow.fsOpenReq.result);
|
||||
ctxNow.isFdOpen = false;
|
||||
}
|
||||
} else {
|
||||
@ -50,18 +50,11 @@ HdcTransferBase::~HdcTransferBase()
|
||||
}
|
||||
};
|
||||
|
||||
void HdcTransferBase::CloseFd(CtxFile *context, ssize_t fd)
|
||||
void HdcTransferBase::CloseFd(ssize_t fd)
|
||||
{
|
||||
uv_fs_t *fs = new uv_fs_t();
|
||||
if (fs == nullptr) {
|
||||
WRITE_LOG(LOG_WARN, "CloseFd fs nullptr");
|
||||
return;
|
||||
}
|
||||
auto callback = [](uv_fs_t *fsPtr) -> void {
|
||||
uv_fs_req_cleanup(fsPtr);
|
||||
delete fsPtr;
|
||||
};
|
||||
uv_fs_close(context->loop, fs, fd, callback);
|
||||
uv_fs_t fs;
|
||||
uv_fs_close(nullptr, fs, fd, nullptr);
|
||||
uv_fs_req_cleanup(&fs);
|
||||
}
|
||||
|
||||
bool HdcTransferBase::ResetCtx(CtxFile *context, bool full)
|
||||
@ -754,7 +747,7 @@ bool HdcTransferBase::CommandDispatch(const uint16_t command, uint8_t *payload,
|
||||
if (!RecvIOPayload(context, payload, payloadSize)) {
|
||||
WRITE_LOG(LOG_DEBUG, "RecvIOPayload return false. channelId:%u lastErrno:%u result:%d",
|
||||
taskInfo->channelId, ctxNow.lastErrno, ctxNow.fsOpenReq.result);
|
||||
CloseFd(&ctxNow, ctxNow.fsOpenReq.result);
|
||||
CloseFd(ctxNow.fsOpenReq.result);
|
||||
ctxNow.isFdOpen = false;
|
||||
HdcTransferBase *thisClass = (HdcTransferBase *)context->thisClass;
|
||||
thisClass->CommandDispatch(CMD_FILE_FINISH, payload, 1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user