aboutsummaryrefslogtreecommitdiff
path: root/tests/server/sockfilt.c
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2011-10-31 07:29:13 +0100
committerYang Tse <yangsita@gmail.com>2011-10-31 07:29:13 +0100
commit8bfc3a800aea9f64efde9faf46311b513329f453 (patch)
tree9b65d84030495934d548b84ad1801e705f8ecffd /tests/server/sockfilt.c
parentb24c28e6c2c7cc24f3829575869c31560bb74f2b (diff)
FTP test server: NODATACONN commands commit c761fcb0 follow-up
Adjustments that make NODATACONN custom commands fully usable.
Diffstat (limited to 'tests/server/sockfilt.c')
-rw-r--r--tests/server/sockfilt.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/server/sockfilt.c b/tests/server/sockfilt.c
index 2731348ea..823b90161 100644
--- a/tests/server/sockfilt.c
+++ b/tests/server/sockfilt.c
@@ -123,6 +123,7 @@
const char *serverlogfile = DEFAULT_LOGFILE;
static bool verbose = FALSE;
+static bool bind_only = FALSE;
#ifdef ENABLE_IPV6
static bool use_ipv6 = FALSE;
#endif
@@ -807,6 +808,12 @@ static curl_socket_t sockdaemon(curl_socket_t sock,
}
}
+ /* bindonly option forces no listening */
+ if(bind_only) {
+ logmsg("instructed to bind port without listening");
+ return sock;
+ }
+
/* start accepting connections */
rc = listen(sock, 5);
if(0 != rc) {
@@ -875,6 +882,10 @@ int main(int argc, char *argv[])
#endif
arg++;
}
+ else if(!strcmp("--bindonly", argv[arg])) {
+ bind_only = TRUE;
+ arg++;
+ }
else if(!strcmp("--port", argv[arg])) {
arg++;
if(argc>arg) {
@@ -923,6 +934,7 @@ int main(int argc, char *argv[])
" --pidfile [file]\n"
" --ipv4\n"
" --ipv6\n"
+ " --bindonly\n"
" --port [port]\n"
" --connect [port]\n"
" --addr [address]");
@@ -1006,6 +1018,8 @@ int main(int argc, char *argv[])
if(connectport)
logmsg("Connected to port %hu", connectport);
+ else if(bind_only)
+ logmsg("Bound without listening on port %hu", port);
else
logmsg("Listening on port %hu", port);