fix WaitForResponse (without timeout) 910/head
authorpwpiwi <pwpiwi@users.noreply.github.com>
Thu, 6 Feb 2020 06:59:18 +0000 (07:59 +0100)
committerpwpiwi <pwpiwi@users.noreply.github.com>
Thu, 6 Feb 2020 06:59:18 +0000 (07:59 +0100)
client/comms.c

index dcbd3adaecd4d88cafc480dd8aeefba41079293c..b3b85fd2dad016ba1a7a518aecb1ca42d145109a 100644 (file)
@@ -472,7 +472,6 @@ bool WaitForResponseTimeoutW(uint32_t cmd, UsbCommand* response, size_t ms_timeo
        #endif
 
        uint64_t start_time = msclock();
-       uint64_t end_time = start_time + ms_timeout;
 
        if (response == NULL) {
                response = &resp;
@@ -480,7 +479,7 @@ bool WaitForResponseTimeoutW(uint32_t cmd, UsbCommand* response, size_t ms_timeo
 
        // Wait until the command is received
        while (true) {
-               if (msclock() > end_time) {
+               if (ms_timeout != -1 && msclock() > start_time + ms_timeout) {
                        break; // timeout
                }
                if (msclock() - start_time > 2000 && show_warning) {
Impressum, Datenschutz