diff options
author | Wan-Teh Chang <wtc@google.com> | 2014-04-09 17:49:21 +0200 |
---|---|---|
committer | Wan-Teh Chang <wtc@google.com> | 2014-04-09 17:49:21 +0200 |
commit | 906b5f98afba45dea193c22d423e61a250890f0c (patch) | |
tree | c050d3e2a57cada01cc5ee5339faff615b04ebf8 /cmd/tstclnt | |
parent | c15dd99be25e118f2be4d64e52df7227986d4101 (diff) | |
download | nss-hg-906b5f98afba45dea193c22d423e61a250890f0c.tar.gz |
Bug 334961, strsclnt: PR_Connect: Local Network address is in use, merged by and r=kaie
Diffstat (limited to 'cmd/tstclnt')
-rw-r--r-- | cmd/tstclnt/tstclnt.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/cmd/tstclnt/tstclnt.c b/cmd/tstclnt/tstclnt.c index b92dcb1a1..2b47004dd 100644 --- a/cmd/tstclnt/tstclnt.c +++ b/cmd/tstclnt/tstclnt.c @@ -1048,7 +1048,8 @@ int main(int argc, char **argv) } err = PR_GetError(); if ((err != PR_CONNECT_REFUSED_ERROR) && - (err != PR_CONNECT_RESET_ERROR)) { + (err != PR_CONNECT_RESET_ERROR) && + (err != PR_ADDRESS_IN_USE_ERROR)) { SECU_PrintError(progName, "TCP Connection failed"); return 1; } @@ -1087,6 +1088,7 @@ int main(int argc, char **argv) disableAllSSLCiphers(); } +retry: /* Create socket */ s = PR_OpenTCPSocket(addr.raw.family); if (s == NULL) { @@ -1257,7 +1259,7 @@ int main(int argc, char **argv) progName); filesReady = PR_Poll(pollset, 1, PR_INTERVAL_NO_TIMEOUT); if (filesReady < 0) { - SECU_PrintError(progName, "unable to connect (poll)"); + SECU_PrintError(progName, "unable to poll"); return 1; } FPRINTF(stderr, @@ -1271,8 +1273,12 @@ int main(int argc, char **argv) if (status == PR_SUCCESS) { break; } + if (PR_GetError() == PR_ADDRESS_IN_USE_ERROR) { + PR_Close(s); + goto retry; + } if (PR_GetError() != PR_IN_PROGRESS_ERROR) { - SECU_PrintError(progName, "unable to connect (poll)"); + SECU_PrintError(progName, "unable to connect"); return 1; } SECU_PrintError(progName, "poll"); |