mirror of
https://github.com/rofafor/vdr-plugin-iptv.git
synced 2023-10-10 13:37:03 +02:00
Tweaked reading from UDP sockets.
This commit is contained in:
parent
06506c41f6
commit
c7cbde301b
4
HISTORY
4
HISTORY
@ -172,3 +172,7 @@ VDR Plugin 'iptv' Revision History
|
|||||||
2012-04-26: Version 0.5.2
|
2012-04-26: Version 0.5.2
|
||||||
|
|
||||||
- Fixed connection problems in HTTP protocol.
|
- Fixed connection problems in HTTP protocol.
|
||||||
|
|
||||||
|
2012-xx-xx: Version 0.5.3
|
||||||
|
|
||||||
|
- Tweaked reading from UDP sockets.
|
||||||
|
2
iptv.c
2
iptv.c
@ -21,7 +21,7 @@
|
|||||||
#define GITVERSION ""
|
#define GITVERSION ""
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char VERSION[] = "0.5.2" GITVERSION;
|
const char VERSION[] = "0.5.3" GITVERSION;
|
||||||
static const char DESCRIPTION[] = trNOOP("Experience the IPTV");
|
static const char DESCRIPTION[] = trNOOP("Experience the IPTV");
|
||||||
|
|
||||||
class cPluginIptv : public cPlugin {
|
class cPluginIptv : public cPlugin {
|
||||||
|
12
socket.c
12
socket.c
@ -180,15 +180,10 @@ int cIptvUdpSocket::Read(unsigned char* BufferAddr, unsigned int BufferLen)
|
|||||||
}
|
}
|
||||||
else if (len > 0) {
|
else if (len > 0) {
|
||||||
// Process auxiliary received data and validate source address
|
// Process auxiliary received data and validate source address
|
||||||
for (cmsg = CMSG_FIRSTHDR(&msgh); (streamAddr != INADDR_ANY) && (cmsg != NULL); cmsg = CMSG_NXTHDR(&msgh, cmsg)) {
|
for (cmsg = CMSG_FIRSTHDR(&msgh); cmsg != NULL; cmsg = CMSG_NXTHDR(&msgh, cmsg)) {
|
||||||
if ((cmsg->cmsg_level == SOL_IP) && (cmsg->cmsg_type == IP_PKTINFO)) {
|
if ((cmsg->cmsg_level == SOL_IP) && (cmsg->cmsg_type == IP_PKTINFO)) {
|
||||||
struct in_pktinfo *i = (struct in_pktinfo *)CMSG_DATA(cmsg);
|
struct in_pktinfo *i = (struct in_pktinfo *)CMSG_DATA(cmsg);
|
||||||
if (i->ipi_addr.s_addr != streamAddr) {
|
if ((i->ipi_addr.s_addr == streamAddr) || (INADDR_ANY == streamAddr)) {
|
||||||
//debug("Discard packet due to invalid source address: %s", inet_ntoa(i->ipi_addr));
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (BufferAddr[0] == TS_SYNC_BYTE)
|
if (BufferAddr[0] == TS_SYNC_BYTE)
|
||||||
return len;
|
return len;
|
||||||
else if (len > 3) {
|
else if (len > 3) {
|
||||||
@ -220,6 +215,9 @@ int cIptvUdpSocket::Read(unsigned char* BufferAddr, unsigned int BufferLen)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user