Commit b3e2930a authored by ubyyj's avatar ubyyj

fix issue that MQTTClient_connect hangs on network outage, for windows

Signed-off-by: 's avatarubyyj <wdyuanyoujun@163.com>
parent e81b6755
...@@ -233,7 +233,7 @@ int Thread_wait_sem(sem_type sem, int timeout) ...@@ -233,7 +233,7 @@ int Thread_wait_sem(sem_type sem, int timeout)
FUNC_ENTRY; FUNC_ENTRY;
#if defined(WIN32) || defined(WIN64) #if defined(WIN32) || defined(WIN64)
rc = WaitForSingleObject(sem, timeout); rc = WaitForSingleObject(sem, timeout < 0 ? 0 : timeout);
#elif defined(OSX) #elif defined(OSX)
rc = (int)dispatch_semaphore_wait(sem, dispatch_time(DISPATCH_TIME_NOW, (int64_t)timeout*1000000L)); rc = (int)dispatch_semaphore_wait(sem, dispatch_time(DISPATCH_TIME_NOW, (int64_t)timeout*1000000L));
#elif defined(USE_TRYWAIT) #elif defined(USE_TRYWAIT)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment