[JDEV] Non-blocking connect in mio.c
Michael Ngarimu
jabber at squalor.org
Wed May 15 19:15:56 CDT 2002
Hi all,
I'm trying to actually build (from source) and run jabberd 1.4.2. I seem
to have a problem with s2s comms so I jumped into the source and strace.
strace shows an attempt at a non-blocking connect....(see below)
fcntl64(14, F_GETFL) = 0x802 (flags
O_RDWR|O_NONBLOCK)
connect(14, {sin_family=AF_INET, sin_port=htons(5269),
sin_addr=inet_addr("208.245.212.108")}}, 16) = -1 EINPROGRESS (Operation
now in progress)
fcntl64(14, F_GETFL) = 0x802 (flags
O_RDWR|O_NONBLOCK)
Unfortunately, mio.c (_mio_connect) doesn't seem to allow for
non-blocking connects!
see mio.c(approx line 528)
if((*cd->cf)(new, (struct sockaddr*)&sa, sizeof sa) < 0)
{
if(cd->cb != NULL)
(*(mio_std_cb)cd->cb)(new, MIO_CLOSED, cd->cb_arg);
cd->connected = -1;
if(new->fd > 0)
close(new->fd);
mio_handlers_free(new->mh);
pool_free(p);
return;
}
It calls connect (a few lines above an fcntl is done with flags |=
O_NONBLOCK) and then checks for return -1, but within the if block
doesn't checking for EINPROGRESS anywhere but instead just cleans up the
socket.
Surely, this must be an issue for people other than just me?
"Help me Obi-Wan-Kenobi, you're my only hope!"
More information about the JDev
mailing list