aboutsummaryrefslogtreecommitdiff
path: root/lib/rtsp.c
diff options
context:
space:
mode:
authorIsaac Boukris <iboukris@gmail.com>2016-12-07 00:39:08 +0200
committerMichael Kaufmann <mail@michael-kaufmann.ch>2016-12-18 12:47:10 +0100
commit82245eaa56c368f6b6b9abf4de63e7d6fb786f71 (patch)
treec843d8d8e23fc1bae1b6964d67320219ca39f679 /lib/rtsp.c
parent6bc1051608a03da2e7a457839e7d21a1b3cfb911 (diff)
Curl_getconnectinfo: avoid checking if the connection is closed
It doesn't benefit us much as the connection could get closed at any time, and also by checking we lose the ability to determine if the socket was closed by reading zero bytes. Reported-by: Michael Kaufmann Closes https://github.com/curl/curl/pull/1134
Diffstat (limited to 'lib/rtsp.c')
-rw-r--r--lib/rtsp.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/rtsp.c b/lib/rtsp.c
index c8484c44b..65c6c3b05 100644
--- a/lib/rtsp.c
+++ b/lib/rtsp.c
@@ -140,7 +140,7 @@ static CURLcode rtsp_setup_connection(struct connectdata *conn)
* want to block the application forever while receiving a stream. Therefore,
* we cannot assume that an RTSP socket is dead just because it is readable.
*
- * Instead, if it is readable, run Curl_getconnectinfo() to peek at the socket
+ * Instead, if it is readable, run Curl_connalive() to peek at the socket
* and distinguish between closed and data.
*/
bool Curl_rtsp_connisdead(struct connectdata *check)
@@ -157,12 +157,9 @@ bool Curl_rtsp_connisdead(struct connectdata *check)
/* socket is in an error state */
ret_val = TRUE;
}
- else if((sval & CURL_CSELECT_IN) && check->data) {
- /* readable with no error. could be closed or could be alive but we can
- only check if we have a proper Curl_easy for the connection */
- curl_socket_t connectinfo = Curl_getconnectinfo(check->data, &check);
- if(connectinfo != CURL_SOCKET_BAD)
- ret_val = FALSE;
+ else if(sval & CURL_CSELECT_IN) {
+ /* readable with no error. could still be closed */
+ ret_val = !Curl_connalive(check);
}
return ret_val;