#include "url.h"
#include "progress.h"
#include "rtsp.h"
-#include "strcase.h"
+#include "rawstr.h"
#include "select.h"
#include "connect.h"
-#include "strdup.h"
/* The last 3 #include files should be in this order */
#include "curl_printf.h"
#include "curl_memory.h"
* 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_connalive() to peek at the socket
+ * Instead, if it is readable, run Curl_getconnectinfo() to peek at the socket
* and distinguish between closed and data.
*/
bool Curl_rtsp_connisdead(struct connectdata *check)
int sval;
bool ret_val = TRUE;
- sval = SOCKET_READABLE(check->sock[FIRSTSOCKET], 0);
+ sval = Curl_socket_ready(check->sock[FIRSTSOCKET], CURL_SOCKET_BAD, 0);
if(sval == 0) {
/* timeout */
ret_val = FALSE;
/* socket is in an error state */
ret_val = TRUE;
}
- else if(sval & CURL_CSELECT_IN) {
- /* readable with no error. could still be closed */
- ret_val = !Curl_connalive(check);
+ 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;
}
return ret_val;
* Free userpwd now --- cannot reuse this for Negotiate and possibly NTLM
* with basic and digest, it will be freed anyway by the next request
*/
- Curl_safefree(conn->allocptr.userpwd);
+ Curl_safefree (conn->allocptr.userpwd);
conn->allocptr.userpwd = NULL;
if(result)
if(rtspc->rtp_buf) {
/* There was some leftover data the last time. Merge buffers */
- char *newptr = Curl_saferealloc(rtspc->rtp_buf,
- rtspc->rtp_bufsize + *nread);
+ char *newptr = realloc(rtspc->rtp_buf, rtspc->rtp_bufsize + *nread);
if(!newptr) {
+ Curl_safefree(rtspc->rtp_buf);
rtspc->rtp_buf = NULL;
rtspc->rtp_bufsize = 0;
return CURLE_OUT_OF_MEMORY;
curl_write_callback writeit;
if(len == 0) {
- failf(data, "Cannot write a 0 size RTP packet.");
+ failf (data, "Cannot write a 0 size RTP packet.");
return CURLE_WRITE_ERROR;
}
wrote = writeit(ptr, 1, len, data->set.rtp_out);
if(CURL_WRITEFUNC_PAUSE == wrote) {
- failf(data, "Cannot pause RTP");
+ failf (data, "Cannot pause RTP");
return CURLE_WRITE_ERROR;
}
if(wrote != len) {
- failf(data, "Failed writing RTP data");
+ failf (data, "Failed writing RTP data");
return CURLE_WRITE_ERROR;
}