mirror of
https://github.com/onyx-and-iris/vmrcli.git
synced 2024-11-15 17:40:56 +00:00
add LOGIN_TIMEOUT macro
This commit is contained in:
parent
b35a29396b
commit
ff69837f19
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
#define KIND_STR_LEN 64
|
#define KIND_STR_LEN 64
|
||||||
#define VERSION_STR_LEN 32
|
#define VERSION_STR_LEN 32
|
||||||
|
#define LOGIN_TIMEOUT 2
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Logs into the API.
|
* @brief Logs into the API.
|
||||||
@ -44,7 +45,6 @@ long login(PT_VMR vmr, int kind)
|
|||||||
kind_as_string(kind_s, kind, KIND_STR_LEN));
|
kind_as_string(kind_s, kind, KIND_STR_LEN));
|
||||||
}
|
}
|
||||||
|
|
||||||
int timeout = 2;
|
|
||||||
time_t start = time(NULL);
|
time_t start = time(NULL);
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
@ -57,7 +57,7 @@ long login(PT_VMR vmr, int kind)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Sleep(50);
|
Sleep(50);
|
||||||
} while (time(NULL) < start + timeout);
|
} while (difftime(time(NULL), start) < LOGIN_TIMEOUT);
|
||||||
|
|
||||||
if (rep == 0)
|
if (rep == 0)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user