sample-server: add a "local only" option to just listen on an UNIX socket

This makes things nicer for tests that don't need internet access.
This commit is contained in:
David Fort
2016-07-06 18:30:12 +02:00
parent 71fd5cc148
commit 5b080359a9

View File

@@ -881,6 +881,7 @@ int main(int argc, char* argv[])
char* file;
char name[MAX_PATH];
int port = 3389, i;
BOOL localOnly = FALSE;
for (i = 1; i < argc; i++)
{
@@ -900,6 +901,8 @@ int main(int argc, char* argv[])
if ((port < 1) || (port > 0xFFFF))
return -1;
}
else if (strcmp(arg, "--local-only"))
localOnly = TRUE;
else if (strncmp(arg, "--", 2))
test_pcap_file = arg;
}
@@ -929,8 +932,8 @@ int main(int argc, char* argv[])
return -1;
}
if (instance->Open(instance, NULL, port) &&
instance->OpenLocal(instance, file))
if ((localOnly || instance->Open(instance, NULL, port)) &&
instance->OpenLocal(instance, file))
{
/* Entering the server main loop. In a real server the listener can be run in its own thread. */
test_server_mainloop(instance);