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

Fixed Open()/Close() when using UDP protocol.

This commit is contained in:
Rolf Ahrenberg 2010-11-29 18:27:39 +02:00
parent ef615c4bc5
commit ea4f8fde31

View File

@ -38,9 +38,9 @@ cIptvProtocolUdp::~cIptvProtocolUdp()
bool cIptvProtocolUdp::Open(void) bool cIptvProtocolUdp::Open(void)
{ {
debug("cIptvProtocolUdp::Open()\n"); debug("cIptvProtocolUdp::Open()\n");
OpenSocket(socketPort, isempty(sourceAddr) ? INADDR_ANY : inet_addr(sourceAddr));
if (!isempty(streamAddr)) { if (!isempty(streamAddr)) {
// Join a new multicast group // Join a new multicast group
OpenSocket(socketPort, isempty(sourceAddr) ? INADDR_ANY : inet_addr(sourceAddr));
JoinMulticast(inet_addr(streamAddr)); JoinMulticast(inet_addr(streamAddr));
} }
return true; return true;
@ -56,6 +56,9 @@ bool cIptvProtocolUdp::Close(void)
} }
// Close the socket // Close the socket
CloseSocket(); CloseSocket();
// Reset stream and source addresses
streamAddr = strcpyrealloc(streamAddr, "");
sourceAddr = strcpyrealloc(sourceAddr, "");
return true; return true;
} }
@ -80,7 +83,7 @@ bool cIptvProtocolUdp::Set(const char* Location, const int Parameter, const int
sourceAddr = strcpyrealloc(sourceAddr, p + 1); sourceAddr = strcpyrealloc(sourceAddr, p + 1);
*p = 0; *p = 0;
} }
else else
sourceAddr = strcpyrealloc(sourceAddr, ""); sourceAddr = strcpyrealloc(sourceAddr, "");
socketPort = Parameter; socketPort = Parameter;
// Join a new multicast group // Join a new multicast group