[Dovecot] adding a select or a poll?

ohp at pyrenet.fr ohp at pyrenet.fr
Tue Jan 31 11:54:12 EET 2006


Since I put my hands on dovecot, I had this recuring problem at startup:

Imap-login would'nt connect to the 'default' socket.
I've been strugling with the fact that it would eventually connect on a
slow or moderely fast machine but not on a really fast machine.

According to Unixware doc, the FIRST connect ALWAYS returns -1 and
errno=EINPROGRESS

AFAICT, imap loop is like this:

while (1)
connect
if no error bu EINPROGRESS
send_handshake
if successfull
   break;
end while

Now, I think the time between connect and send_handshake might be too
short for async connect to finish in most case.

I recognize is a Unixware probleme but I think this senario can happen on
any system that CAN set errno to EINPROGRESS.

I think the two possibilities are
1 - remove the setting of NONBLOCK before connecting to unix sock, but
that would  ruin the way dovecot is written.
2 - add a poll or a select before send_handshake to be sure the socket is
writable.

The third way would be to tell unixware users to disable async connects
methink would be a pitta.

What do you think?

-- 
Olivier PRENANT        	        Tel: +33-5-61-50-97-00 (Work)
15, Chemin des Monges                +33-5-61-50-97-01 (Fax)
31190 AUTERIVE                       +33-6-07-63-80-64 (GSM)
FRANCE                          Email: ohp at pyrenet.fr
------------------------------------------------------------------------------
Make your life a dream, make your dream a reality. (St Exupery)


More information about the dovecot mailing list