1
0
mirror of https://github.com/rofafor/vdr-plugin-iptv.git synced 2023-10-10 13:37:03 +02:00

Clean up of semi-opened socket and error handling of failed open -call.

This commit is contained in:
Antti Seppälä 2007-09-29 11:17:57 +00:00
parent 683b5bd66c
commit 6e45224b00
2 changed files with 11 additions and 5 deletions

View File

@ -3,7 +3,7 @@
* *
* See the README file for copyright information and how to reach the author. * 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 <sys/types.h> #include <sys/types.h>
@ -137,6 +137,7 @@ bool cIptvProtocolHttp::Connect(void)
if (err < 0 && errno != EINPROGRESS) { if (err < 0 && errno != EINPROGRESS) {
char tmp[64]; char tmp[64];
error("ERROR: Connect(): %s", strerror_r(errno, tmp, sizeof(tmp))); error("ERROR: Connect(): %s", strerror_r(errno, tmp, sizeof(tmp)));
CloseSocket();
return false; return false;
} }
@ -166,6 +167,7 @@ bool cIptvProtocolHttp::Connect(void)
error("Cannot connect to %s\n", streamAddr); error("Cannot connect to %s\n", streamAddr);
char tmp[64]; char tmp[64];
error("ERROR: %s", strerror_r(socketStatus, tmp, sizeof(tmp))); error("ERROR: %s", strerror_r(socketStatus, tmp, sizeof(tmp)));
CloseSocket();
return false; return false;
} }
@ -185,12 +187,15 @@ bool cIptvProtocolHttp::Connect(void)
if (err < 0) { if (err < 0) {
char tmp[64]; char tmp[64];
error("ERROR: send(): %s", strerror_r(errno, tmp, sizeof(tmp))); error("ERROR: send(): %s", strerror_r(errno, tmp, sizeof(tmp)));
CloseSocket();
return false; return false;
} }
// Now process headers // Now process headers
if (!ProcessHeaders()) if (!ProcessHeaders()) {
CloseSocket();
return false; return false;
}
// Update active flag // Update active flag
isActive = true; isActive = true;

View File

@ -3,7 +3,7 @@
* *
* See the README file for copyright information and how to reach the author. * 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 <vdr/thread.h> #include <vdr/thread.h>
@ -57,7 +57,8 @@ bool cIptvStreamer::Open(void)
debug("cIptvStreamer::Open()\n"); debug("cIptvStreamer::Open()\n");
// Open the protocol // Open the protocol
if (protocol) if (protocol)
protocol->Open(); if(!protocol->Open())
return false;
// Start thread // Start thread
Start(); Start();
return true; return true;