Closed Bug 5802 Opened 26 years ago Closed 25 years ago

Synchronization needed in the nblayer test

Categories

(NSPR :: NSPR, defect, P3)

3.1.1
defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: wtc, Assigned: wtc)

Details

The nblayer tests creates a server thread, which accepts connections on a listening socket, and a client thread, which connects to the listening socket. Right now there is no synchronization between the server and client threads, so the client thread may invoke PR_Connect before the server thread can invoke PR_Listen, in which case the PR_Connect call fails with PR_CONNECT_REFUSED_ERROR. This results in an assertion failure in the debug build and a hang in optimized build. We should add synchronization code to wait until the server thread has invoked PR_Listen before creating the client thread.
Status: NEW → ASSIGNED
I decided to fix this by calling PR_Bind and PR_Listen on the server socket before passing it to the server thread. Then we don't need any synchronization between the server and client threads. Checked in the fix to the internal repository. /m/src/ns/nspr20/pr/tests/nblayer.c, revision 2.10 Checked in the fix to the internal NSPR20_RELEASE_3_5_BRANCH. /m/src/ns/nspr20/pr/tests/nblayer.c, revision 2.9.2.1
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
The fix is checked in. /cvsroot/mozilla/nsprpub/pr/tests/nblayer.c, revision 1.6
You need to log in before you can comment on or make changes to this bug.