diff --git a/protocolhttp.c b/protocolhttp.c index 1a499f0..705d29f 100644 --- a/protocolhttp.c +++ b/protocolhttp.c @@ -3,7 +3,7 @@ * * See the README file for copyright information and how to reach the author. * - * $Id: protocolhttp.c,v 1.7 2007/09/29 10:55:14 ajhseppa Exp $ + * $Id: protocolhttp.c,v 1.8 2007/09/29 11:17:57 ajhseppa Exp $ */ #include @@ -137,6 +137,7 @@ bool cIptvProtocolHttp::Connect(void) if (err < 0 && errno != EINPROGRESS) { char tmp[64]; error("ERROR: Connect(): %s", strerror_r(errno, tmp, sizeof(tmp))); + CloseSocket(); return false; } @@ -166,6 +167,7 @@ bool cIptvProtocolHttp::Connect(void) error("Cannot connect to %s\n", streamAddr); char tmp[64]; error("ERROR: %s", strerror_r(socketStatus, tmp, sizeof(tmp))); + CloseSocket(); return false; } @@ -185,12 +187,15 @@ bool cIptvProtocolHttp::Connect(void) if (err < 0) { char tmp[64]; error("ERROR: send(): %s", strerror_r(errno, tmp, sizeof(tmp))); + CloseSocket(); return false; } // Now process headers - if (!ProcessHeaders()) - return false; + if (!ProcessHeaders()) { + CloseSocket(); + return false; + } // Update active flag isActive = true; diff --git a/streamer.c b/streamer.c index 5b27af6..364052f 100644 --- a/streamer.c +++ b/streamer.c @@ -3,7 +3,7 @@ * * See the README file for copyright information and how to reach the author. * - * $Id: streamer.c,v 1.14 2007/09/21 21:50:52 rahrenbe Exp $ + * $Id: streamer.c,v 1.15 2007/09/29 11:17:57 ajhseppa Exp $ */ #include @@ -57,7 +57,8 @@ bool cIptvStreamer::Open(void) debug("cIptvStreamer::Open()\n"); // Open the protocol if (protocol) - protocol->Open(); + if(!protocol->Open()) + return false; // Start thread Start(); return true;