- From: Thomas Dreibholz <dreibh AT exp-math.uni-essen.de>
- To: "Marjan Bozinovski" <marjanb AT cpk.auc.dk>,	<rsplib-discussion AT sctp.de>
- Subject: Re: [RSPlib-Discusssion] connectToPoolElement()
- Date: Tue Oct 22 14:02:01 2002
- List-id: RSPlib Discussions <rsplib-discussion.sctp.de>
- Organization: University of Essen, Institute for Experimental Mathematics
 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Am Dienstag, 22. Oktober 2002 13:17 schrieb Marjan Bozinovski:
>
 >If you are using the same version of connectToPoolElement() as in
>
 >examplepu.c, the ext_select() call after the ext_connect() should wait
>
>
 until
>
>
 >the connection is successfully established. The ext_connect() itself
>
 >immediately returns, since the socket is set to non-blocking. Therefore,
>
>
 the
>
>
 >ext_select() is necessary.
>
 >Please check if the ext_select() is executed and that there is no fork().
>
>
 If
>
>
 >the source is okay, send me the debug output (including all the debug
>
 >#defines in the socket API enabled as for finding the fork() problem).
>
 > Also send me your latest source, so I can try to reproduce it on our
>
 > FreeBSD machine.
>
>
 I am using the same connectToPoolElement() as in examplepu.c. But,
>
 ext_select() is never executed. The ext_connect() returns 0, so in the next
>
 "if" ext_select is not executed.
There is a bug in ext_connect() setting the return value to 0 although 
the socket is non-blocking. In the non-blocking case, the result should be -1 
and errno=EINPROGRESS. Go to sctpsocketwrapper.cc, ext_connect() and change
tdSocket->Socket.SCTPSocketDesc.SCTPAssociationPtr =
   tdSocket->Socket.SCTPSocketDesc.SCTPSocketPtr->associate(
      tdSocket->Socket.SCTPSocketDesc.InitMsg.sinit_num_ostreams,
      *address,
      !(tdSocket->Socket.SCTPSocketDesc.Flags & O_NONBLOCK));
delete address;
if(tdSocket->Socket.SCTPSocketDesc.SCTPAssociationPtr == NULL) {
   errno_return(-EIO);
}
errno_return(0);
to
tdSocket->Socket.SCTPSocketDesc.SCTPAssociationPtr =
   tdSocket->Socket.SCTPSocketDesc.SCTPSocketPtr->associate(
      tdSocket->Socket.SCTPSocketDesc.InitMsg.sinit_num_ostreams,
      *address,
      !(tdSocket->Socket.SCTPSocketDesc.Flags & O_NONBLOCK));
delete address;
if(tdSocket->Socket.SCTPSocketDesc.SCTPAssociationPtr == NULL) {
   errno_return(-EIO);
}
// ###### Add this!
else if(tdSocket->Socket.SCTPSocketDesc.Flags & O_NONBLOCK) {
   errno_return(-EINPROGRESS);
}
// ################
errno_return(0);
Now, ext_connect() should return -1 and errno=EINPROGRESS for non-blocking 
sockets and connectToPoolElement() should work.
Best regards
- -- 
=======================================================================
 Dipl.-Inform. Thomas Dreibholz
 University of Essen,                            Room ES210
 Inst. for Experimental Mathematics              Ellernstraße 29
 Computer Networking Technology Group            D-45326 Essen/Germany
- -----------------------------------------------------------------------
 E-Mail:     
dreibh AT exp-math.uni-essen.de
 Homepage:   
http://www.exp-math.uni-essen.de/~dreibh
=======================================================================
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see 
http://www.gnupg.org
iD8DBQE9tT0o32BbsHYPLWURAtlrAKCtKAO1V24KZoFB0+F516y4MVWjrwCgreSx
KmtVfYafoI8Ii6nBB5DkplE=
=MO6b
-----END PGP SIGNATURE-----
Archive powered by MHonArc 2.6.19+.