> From: Arvind Umrao <[email protected]> > Date: Thu, 23 Aug 2012 16:07:39 +0530 > > Code changes are integrated in Solaris and now I am trying to give back to > community. If Socket is getting interrupted with signal EINTR, we should keep > socket in progress state(TRANS_IN_PROGRESS) instead of trying again to > connect(TRANS_TRY_CONNECT_AGAIN). When we close the socket connection on > signal EINTR and retry, we will end up in same old state and stuck in loop. > As per documentation if Connect() is interrupted by a signal that is caught, > while blocked waiting to establish a connection, connect() shall fail and set > connect() to [EINTR], but the connection request shall not be aborted, and > the connection shall be established asynchronously. When the connection has > been established asynchronously, select() and poll() shall indicate that the > file descriptor for the socket is ready for writing. > > Refer http://www.madore.org/~david/computers/connect-intr.html
The problem with this change is that currently TRANS_IN_PROGRESS could only happen for TRANS_NONBLOCKING sockets, whereas with this change it suddenly can happen for normal blocking sockets as well. Look for example at the code in libICE/src/connect.c:ConnectToPeer(). I wouldn't be surprised if the sleep(1) you see there was put in to mitigate this problem. Because of that sleep the connect() is likely to succeed the next time around. But with your change this turns into a guaranteed failure! So I don't think you can make this change without making fixes to the code that uses this functionality. Is this code used outside of xorg? In any case, if you make this change, you should also change the comments that describe what the current EINTR behaviour. > Signed-off-by: Arvind Umrao <[email protected]> > --- > Xtranssock.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
