diff options
author | wtc%netscape.com <devnull@localhost> | 2000-01-14 00:22:37 +0000 |
---|---|---|
committer | wtc%netscape.com <devnull@localhost> | 2000-01-14 00:22:37 +0000 |
commit | 23dbd04a71341943be2e3da0fc13fd73c325b05a (patch) | |
tree | c0928663462847aa6e34f820ed68c930e2a41156 | |
parent | 2b853438a90efcb00095247fb8f9d370f0e7d7d6 (diff) | |
download | nspr-hg-23dbd04a71341943be2e3da0fc13fd73c325b05a.tar.gz |
Set the reuseaddr socket option before calling PR_Bind.
-rw-r--r-- | pr/tests/tmoacc.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/pr/tests/tmoacc.c b/pr/tests/tmoacc.c index bda47e19..2fe746c4 100644 --- a/pr/tests/tmoacc.c +++ b/pr/tests/tmoacc.c @@ -180,6 +180,7 @@ PRIntn Tmoacc(PRIntn argc, char **argv) PLOptStatus os; PRThread **thread; PRNetAddr listenAddr; + PRSocketOptionData sockOpt; PRIntn timeout = DEFAULT_TIMEOUT; PRIntn threads = DEFAULT_THREADS; PRIntn backlog = DEFAULT_BACKLOG; @@ -243,6 +244,10 @@ PRIntn Tmoacc(PRIntn argc, char **argv) shared->listenSock = PR_NewTCPSocket(); if (shared->listenSock) { + sockOpt.option = PR_SockOpt_Reuseaddr; + sockOpt.value.reuse_addr = PR_TRUE; + rv = PR_SetSocketOption(shared->listenSock, &sockOpt); + PR_ASSERT(PR_SUCCESS == rv); rv = PR_Bind(shared->listenSock, &listenAddr); if (rv != PR_FAILURE) { |