I was reviewing the code in RTSPClient::openConnectionFromUrl(), and I had a question about the codepath involving setting a timeout. In particular, this code:<br><br>//Start change for timeout on connect<br><br> /*<br>
if (connect(fInputSocketNum, (struct sockaddr*)&remoteName, sizeof remoteName)<br>
!= 0) {<br> envir().setResultErrMsg("<div id=":4q" class="ii gt">connect() failed: ");<br> break;<br> */<br> fd_set set;<br> FD_ZERO(&set);<br> timeval tvout = {0,0};<br>
if (timeout > 0) {<br>
FD_SET((unsigned)fInputSocketNum, &set);<br> tvout.tv_sec = timeout;<br> tvout.tv_usec = 0;<br> makeSocketNonBlocking(fInputSocketNum);<br> }<br> if (connect(fInputSocketNum, (struct sockaddr*) &remoteName, sizeof remoteName) != 0) <br>
{<br> if (envir().getErrno() != EINPROGRESS && envir().getErrno() != EWOULDBLOCK) <br> {<br> envir().setResultErrMsg("connect() failed: ");<br> break;<br>
}<br> if (timeout > 0 && (select(fInputSocketNum + 1, NULL, &set, NULL, &tvout) <= 0)) <br> {<br> envir().setResultErrMsg("select/connect() failed: ");<br>
break;<br> }<br> /*<br> errno = 0;<br> if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &err, &len) < 0 || errno != 0 )<br> {<br> break;<br> }<br>
*/<br> //End change for timeout on connect<br> }<br><br>...I see that if timeout > 0, then fInputSocketNum is set to a non-blocking socket (i.e. makeSocketNonBlocking). Shouldn't this get set back to a blocking socket once this connect attempt is completed? <br>
<br>(it may be that this happens somewhere else, but my quick checks through the code didn't reveal any such code)<br><br>If this is an issue, I have code I can submit that will set the socket back to blocking.<br><br>
Thanks!<br></div><br>