Handle a ton more nspr i/o errno's. (stream_connect): Act as if we are
2002-04-02 Jeffrey Stedfast <fejj@ximian.com> * camel-tcp-stream-ssl.c (set_errno): Handle a ton more nspr i/o errno's. (stream_connect): Act as if we are doing a non-blocking connect. This is to try and work around bug #15120 where users get an EINPROGRESS error. Maybe importing a PRFileDesc into SSL mode automagically makes it non-blocking? I dunno. 2002-04-01 Jeffrey Stedfast <fejj@ximian.com> * camel-folder-summary.c (message_info_new): Updated the construction of the references to match JWZ's updated algorithm initialization (ie, append any In-Reply-To reference onto any References header and never take more than a single message-id from the In-Reply-To header since anything after the first will probably just be email addresses). Fixes bug #1336. svn path=/trunk/; revision=16327
This commit is contained in:

committed by
Jeffrey Stedfast

parent
22fe7e4d3a
commit
be23d106da
@ -205,6 +205,9 @@ set_errno (int code)
|
||||
{
|
||||
/* FIXME: this should handle more. */
|
||||
switch (code) {
|
||||
case PR_INVALID_ARGUMENT_ERROR:
|
||||
errno = EINVAL;
|
||||
break;
|
||||
case PR_PENDING_INTERRUPT_ERROR:
|
||||
errno = EINTR;
|
||||
break;
|
||||
@ -215,6 +218,27 @@ set_errno (int code)
|
||||
case PR_WOULD_BLOCK_ERROR:
|
||||
errno = EWOULDBLOCK;
|
||||
break;
|
||||
case PR_IN_PROGRESS_ERROR:
|
||||
errno = EINPROGRESS;
|
||||
break;
|
||||
case PR_ALREADY_INITIATED_ERROR:
|
||||
errno = EALREADY;
|
||||
break;
|
||||
case PR_NETWORK_UNREACHABLE_ERROR:
|
||||
errno = EHOSTUNREACH;
|
||||
break;
|
||||
case PR_CONNECT_REFUSED_ERROR:
|
||||
errno = ECONNREFUSED;
|
||||
break;
|
||||
case PR_CONNECT_TIMEOUT_ERROR:
|
||||
errno = ETIMEDOUT;
|
||||
break;
|
||||
case PR_NOT_CONNECTED_ERROR:
|
||||
errno = ENOTCONN;
|
||||
break;
|
||||
case PR_CONNECT_RESET_ERROR:
|
||||
errno = ECONNRESET;
|
||||
break;
|
||||
case PR_IO_ERROR:
|
||||
default:
|
||||
errno = EIO;
|
||||
@ -578,12 +602,39 @@ stream_connect (CamelTcpStream *stream, struct hostent *host, int port)
|
||||
int errnosave;
|
||||
|
||||
set_errno (PR_GetError ());
|
||||
errnosave = errno;
|
||||
PR_Close (fd);
|
||||
ssl->priv->sockfd = NULL;
|
||||
errno = errnosave;
|
||||
|
||||
return -1;
|
||||
if (errno == EINPROGRESS) {
|
||||
gboolean connected = FALSE;
|
||||
PRPollDesc poll;
|
||||
|
||||
do {
|
||||
poll.fd = fd;
|
||||
poll.in_flags = PR_POLL_WRITE | PR_POLL_EXCEPT;
|
||||
poll.out_flags = 0;
|
||||
|
||||
timeout = PR_INTERVAL_MIN;
|
||||
|
||||
if (PR_Poll (&poll, 1, timeout) == PR_FAILURE) {
|
||||
set_errno (PR_GetError ());
|
||||
goto exception;
|
||||
}
|
||||
|
||||
if (PR_GetConnectStatus (&poll) == PR_FAILURE) {
|
||||
set_errno (PR_GetError ());
|
||||
if (errno != EINPROGRESS)
|
||||
goto exception;
|
||||
} else {
|
||||
connected = TRUE;
|
||||
}
|
||||
} while (!connected);
|
||||
} else {
|
||||
exception:
|
||||
errnosave = errno;
|
||||
PR_Close (fd);
|
||||
ssl->priv->sockfd = NULL;
|
||||
errno = errnosave;
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
ssl->priv->sockfd = fd;
|
||||
|
Reference in New Issue
Block a user