From 77c840b2dede0b16d43e6daa64d2b33c73f33a83 Mon Sep 17 00:00:00 2001 From: "ethan.du" Date: Wed, 15 Jul 2020 18:02:51 +0800 Subject: [PATCH] fix ota timeout in freertos&nos --- platform/os/freertos/HAL_TCP_freertos.c | 4 ++-- platform/os/nos/HAL_TCP_nos.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/os/freertos/HAL_TCP_freertos.c b/platform/os/freertos/HAL_TCP_freertos.c index 2fef5aa..144485f 100644 --- a/platform/os/freertos/HAL_TCP_freertos.c +++ b/platform/os/freertos/HAL_TCP_freertos.c @@ -116,7 +116,7 @@ int32_t HAL_TCP_Write(_IN_ uintptr_t fd, _IN_ unsigned char *buf, _IN_ size_t le FD_SET(tcp_fd, &sets); tv.tv_sec = 0; - tv.tv_usec = timeout_ms; + tv.tv_usec = timeout_ms * 1000; ret = select(tcp_fd + 1, NULL, &sets, NULL, &tv); if (ret > 0) { if (0 == FD_ISSET(tcp_fd, &sets)) { @@ -183,7 +183,7 @@ int32_t HAL_TCP_Read(_IN_ uintptr_t fd, _OU_ unsigned char *buf, _IN_ size_t len FD_SET(tcp_fd, &sets); tv.tv_sec = 0; - tv.tv_usec = timeout_ms; + tv.tv_usec = timeout_ms * 1000; int ret = lwip_select(tcp_fd + 1, &sets, NULL, NULL, &tv); if (ret > 0) { ret = lwip_recv(tcp_fd, buf + len_recv, len - len_recv, 0); diff --git a/platform/os/nos/HAL_TCP_nos.c b/platform/os/nos/HAL_TCP_nos.c index 2fef5aa..144485f 100644 --- a/platform/os/nos/HAL_TCP_nos.c +++ b/platform/os/nos/HAL_TCP_nos.c @@ -116,7 +116,7 @@ int32_t HAL_TCP_Write(_IN_ uintptr_t fd, _IN_ unsigned char *buf, _IN_ size_t le FD_SET(tcp_fd, &sets); tv.tv_sec = 0; - tv.tv_usec = timeout_ms; + tv.tv_usec = timeout_ms * 1000; ret = select(tcp_fd + 1, NULL, &sets, NULL, &tv); if (ret > 0) { if (0 == FD_ISSET(tcp_fd, &sets)) { @@ -183,7 +183,7 @@ int32_t HAL_TCP_Read(_IN_ uintptr_t fd, _OU_ unsigned char *buf, _IN_ size_t len FD_SET(tcp_fd, &sets); tv.tv_sec = 0; - tv.tv_usec = timeout_ms; + tv.tv_usec = timeout_ms * 1000; int ret = lwip_select(tcp_fd + 1, &sets, NULL, NULL, &tv); if (ret > 0) { ret = lwip_recv(tcp_fd, buf + len_recv, len - len_recv, 0);