Skip to content

Commit

Permalink
perf(cpp): 文件传输超时时长单位由sec改为millisec
Browse files Browse the repository at this point in the history
  • Loading branch information
pdt012 committed Mar 10, 2023
1 parent 35ad1db commit 9b85f48
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions cpp/src/hsocket/header/hclient.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class HTcpChannelClient : public HTcpClient
std::thread thMessage;
std::mutex mtxFTPort;
std::condition_variable conFTPort;
int ftTimeout = 15;
int ftTimeout = 15000;

public:
HTcpChannelClient();
Expand All @@ -127,8 +127,8 @@ class HTcpChannelClient : public HTcpClient
* @brief 设置文件传输的超时时长
* @param sec
*/
void setFTTimeout(int sec) {
ftTimeout = sec;
void setFTTimeout(int msec) {
ftTimeout = msec;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/hsocket/source/hclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ void HTcpChannelClient::messageHandle()
bool HTcpChannelClient::getFTTransferPort()
{
std::unique_lock<std::mutex> ulock(mtxFTPort);
std::cv_status status = conFTPort.wait_for(ulock, std::chrono::seconds(ftTimeout));
std::cv_status status = conFTPort.wait_for(ulock, std::chrono::milliseconds(ftTimeout));
if (status == std::cv_status::no_timeout)
return true;
else
Expand Down

0 comments on commit 9b85f48

Please sign in to comment.