mirror of
https://github.com/espressif/openthread.git
synced 2026-09-02 07:10:08 +00:00
Add timeout parameter to NodeAPI's ping function (#1440)
* Added timeout variable to API's ping function (WIN only).
This commit is contained in:
committed by
Jonathan Hui
parent
5cd94ef937
commit
83918bc76f
@@ -1728,7 +1728,7 @@ OTNODEAPI const char* OTCALL otNodeScan(otNode* aNode)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
OTNODEAPI uint32_t OTCALL otNodePing(otNode* aNode, const char *aAddr, uint16_t aSize, uint32_t aMinReplies)
|
||||
OTNODEAPI uint32_t OTCALL otNodePing(otNode* aNode, const char *aAddr, uint16_t aSize, uint32_t aMinReplies, uint16_t aTimeout)
|
||||
{
|
||||
otLogFuncEntryMsg("[%d] %s (%d bytes)", aNode->mId, aAddr, aSize);
|
||||
printf("%d: ping %s (%d bytes)\r\n", aNode->mId, aAddr, aSize);
|
||||
@@ -1846,7 +1846,8 @@ OTNODEAPI uint32_t OTCALL otNodePing(otNode* aNode, const char *aAddr, uint16_t
|
||||
{
|
||||
//printf("waiting for completion event...\r\n");
|
||||
// Wait for the receive to complete
|
||||
result = WSAWaitForMultipleEvents(1, &Overlapped.hEvent, TRUE, (DWORD)(5000 - (GetTickCount64() - StartTick)), TRUE);
|
||||
ULONGLONG elapsed = (GetTickCount64() - StartTick);
|
||||
result = WSAWaitForMultipleEvents(1, &Overlapped.hEvent, TRUE, (DWORD)(aTimeout - min(aTimeout, elapsed)), TRUE);
|
||||
if (result == WSA_WAIT_TIMEOUT)
|
||||
{
|
||||
//printf("recv timeout\r\n");
|
||||
|
||||
Reference in New Issue
Block a user