Attempt to make NetworkTest work on Windows
This commit is contained in:
parent
2a39267b38
commit
b0e996cda3
1 changed files with 11 additions and 1 deletions
|
@ -1,7 +1,6 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <threads.h>
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#ifdef UDPC_LIBSODIUM_ENABLED
|
#ifdef UDPC_LIBSODIUM_ENABLED
|
||||||
|
@ -10,6 +9,13 @@
|
||||||
|
|
||||||
#include <UDPC.h>
|
#include <UDPC.h>
|
||||||
|
|
||||||
|
#if UDPC_PLATFORM == UDPC_PLATFORM_WINDOWS
|
||||||
|
#include <synchapi.h>
|
||||||
|
#include <ws2tcpip.h>
|
||||||
|
#elif UDPC_PLATFORM == UDPC_PLATFORM_MAC || UDPC_PLATFORM == UDPC_PLATFORM_LINUX
|
||||||
|
#include <threads.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#define QUEUED_MAX_SIZE 32
|
#define QUEUED_MAX_SIZE 32
|
||||||
#define SEND_IDS_SIZE 64
|
#define SEND_IDS_SIZE 64
|
||||||
#define WHITELIST_FILES_SIZE 64
|
#define WHITELIST_FILES_SIZE 64
|
||||||
|
@ -33,10 +39,14 @@ void usage() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void sleep_seconds(unsigned int seconds) {
|
void sleep_seconds(unsigned int seconds) {
|
||||||
|
#if UDPC_PLATFORM == UDPC_PLATFORM_WINDOWS
|
||||||
|
Sleep(seconds * 1000);
|
||||||
|
#elif UDPC_PLATFORM == UDPC_PLATFORM_MAC || UDPC_PLATFORM == UDPC_PLATFORM_LINUX
|
||||||
struct timespec duration;
|
struct timespec duration;
|
||||||
duration.tv_sec = seconds;
|
duration.tv_sec = seconds;
|
||||||
duration.tv_nsec = 0;
|
duration.tv_nsec = 0;
|
||||||
thrd_sleep(&duration, NULL);
|
thrd_sleep(&duration, NULL);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
|
|
Loading…
Reference in a new issue