Closed Bug 42900 Opened 25 years ago Closed 25 years ago

PR_Connect doesn't time out in the NT version

Categories

(NSPR :: NSPR, defect, P3)

x86
Windows NT
defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: wtc, Assigned: wtc)

Details

Attachments

(2 files)

In the NT version of NSPR, PR_Connect does not time out. The timeout argument is ignored, and PR_Connect blocks until the native connect function returns. This bug is present in all NSPR releases.
Status: NEW → ASSIGNED
Target Milestone: --- → 4.1
Attached file conn.c: a test case.
Attached patch Proposed patch.Splinter Review
In the patch (attachment id=11538) I also cleaned up the code in _PR_MD_CONNECT for the nonblocking case, but it is the blocking case that's interesting. In the blocking case, the only way to wait with a timeout is to initiate a non-blocking connect and wait in select, which supports timeout. So I set the socket non-blocking temporarily, initiate a non-blocking connect, wait in select for the completion of the non-blocking connect, and then set the socket back to blocking. I've tested this code with the test case conn.c. Invoke the test on a host name that has a DNS entry but isn't on the network. For example, ebola.mcom.com is such a machine in our network: conn ebola.mcom.com The test correctly times out with the error code -5990 (PR_IO_TIMEOUT_ERROR) after two seconds. I checked in the patch (on the main trunk). /cvsroot/mozilla/nsprpub/pr/src/md/windows/ntio.c, revision 3.32
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: