changeset 21567:3cc80f0855e1

Make sure closesocket is called.
author reimar
date Sun, 10 Dec 2006 19:47:24 +0000
parents 79d969f9eec0
children 51a7cbc52102
files stream/http.c
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/stream/http.c	Sun Dec 10 19:38:41 2006 +0000
+++ b/stream/http.c	Sun Dec 10 19:47:24 2006 +0000
@@ -717,6 +717,7 @@
 	return -1;
 }
 
+//! If this function succeeds you must closesocket stream->fd
 static int http_streaming_start(stream_t *stream, int* file_format) {
 	HTTP_header_t *http_hdr = NULL;
 	unsigned int i;
@@ -877,6 +878,9 @@
 	if ((!is_icy && !is_ultravox) || scast_streaming_start(stream))
 	if(nop_streaming_start( stream )) {
 		mp_msg(MSGT_NETWORK,MSGL_ERR,"nop_streaming_start failed\n");
+		if (stream->fd >= 0)
+			closesocket(stream->fd);
+		stream->fd = -1;
 		streaming_ctrl_free(stream->streaming_ctrl);
 		stream->streaming_ctrl = NULL;
 		return STREAM_UNSUPORTED;
@@ -902,6 +906,9 @@
 	mp_msg(MSGT_OPEN, MSGL_V, "STREAM_HTTP(1), URL: %s\n", stream->url);
 	seekable = http_streaming_start(stream, file_format);
 	if((seekable < 0) || (*file_format == DEMUXER_TYPE_ASF)) {
+		if (stream->fd >= 0)
+			closesocket(stream->fd);
+		stream->fd = -1;
 		streaming_ctrl_free(stream->streaming_ctrl);
 		stream->streaming_ctrl = NULL;
 		return STREAM_UNSUPORTED;
@@ -926,6 +933,9 @@
 	mp_msg(MSGT_OPEN, MSGL_V, "STREAM_HTTP(2), URL: %s\n", stream->url);
 	seekable = http_streaming_start(stream, file_format);
 	if(seekable < 0) {
+		if (stream->fd >= 0)
+			closesocket(stream->fd);
+		stream->fd = -1;
 		streaming_ctrl_free(stream->streaming_ctrl);
 		stream->streaming_ctrl = NULL;
 		return STREAM_UNSUPORTED;