if(!fd->secret->nonblocking && (err == EINPROGRESS)) {
if(!fd->secret->nonblocking && (err == EINTR)) {
_MD_connect (PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen,             PRIntervalTime timeout){    PRInt32 rv, err;    PRThread *me = _PR_MD_CURRENT_THREAD();    PRInt32 osfd = fd->secret->md.osfd;#ifndef BONE_VERSION    fd->secret->md.connectValueValid = PR_FALSE;#endif#ifdef _PR_HAVE_SOCKADDR_LEN    PRNetAddr addrCopy;    addrCopy = *addr;    ((struct sockaddr *) &addrCopy)->sa_len = addrlen;    ((struct sockaddr *) &addrCopy)->sa_family = addr->raw.family;#endif    /* (Copied from unix.c)     * We initiate the connection setup by making a nonblocking connect()     * call.  If the connect() call fails, there are two cases we handle     * specially:     * 1. The connect() call was interrupted by a signal.  In this case     *    we simply retry connect().     * 2. The NSPR socket is nonblocking and connect() fails with     *    EINPROGRESS.  We first wait until the socket becomes writable.     *    Then we try to find out whether the connection setup succeeded     *    or failed.     */retry:#ifdef _PR_HAVE_SOCKADDR_LEN    if ((rv = connect(osfd, (struct sockaddr *)&addrCopy, addrlen)) == -1) {#else    if ((rv = connect(osfd, (struct sockaddr *)addr, addrlen)) == -1) {#endif        err = _MD_ERRNO();#ifndef BONE_VERSION        fd->secret->md.connectReturnValue = rv;        fd->secret->md.connectReturnError = err;        fd->secret->md.connectValueValid = PR_TRUE;#endif        if( err == EINTR ) {            if( _PR_PENDING_INTERRUPT(me)) {                me->flags &= ~_PR_INTERRUPT;                PR_SetError( PR_PENDING_INTERRUPT_ERROR, 0);                return -1;            }#ifndef BONE_VERSION            snooze( 100000L );#endif            goto retry;        }#ifndef BONE_VERSION        if(!fd->secret->nonblocking && ((err == EINPROGRESS) || (err==EAGAIN) || (err==EALREADY))) {            /*            ** There's no timeout on this connect, but that's not            ** a big deal, since the connect times out anyways            ** after 30 seconds.   Just sleep for 1/10th of a second            ** and retry until we go through or die.            */            if( _PR_PENDING_INTERRUPT(me)) {                me->flags &= ~_PR_INTERRUPT;                PR_SetError( PR_PENDING_INTERRUPT_ERROR, 0);                return -1;            }            goto retry;        }        if( fd->secret->nonblocking && ((err == EAGAIN) || (err == EINPROGRESS))) {            PR_Lock(_connectLock);            connectList[connectCount].osfd = osfd;            memcpy(&connectList[connectCount].addr, addr, addrlen);            connectList[connectCount].addrlen = addrlen;            connectList[connectCount].timeout = timeout;            connectCount++;            PR_Unlock(_connectLock);            _PR_MD_MAP_CONNECT_ERROR(err);            return rv;        }#else /* BONE_VERSION */        if(!fd->secret->nonblocking && (err == EINPROGRESS)) {            rv = socket_io_wait(osfd, WRITE_FD, timeout);            if (rv == -1) {                return -1;            }            PR_ASSERT(rv == 1);            if (_PR_PENDING_INTERRUPT(me)) {                me->flags &= ~_PR_INTERRUPT;                PR_SetError( PR_PENDING_INTERRUPT_ERROR, 0);                return -1;            }            err = _MD_beos_get_nonblocking_connect_error(osfd);            if (err != 0) {                _PR_MD_MAP_CONNECT_ERROR(err);                return -1;            }            return 0;        }#endif        _PR_MD_MAP_CONNECT_ERROR(err);    }    return rv;}