5
0
Fork 0
mirror of https://github.com/TheTesla/HengLongUDPclient.git synced 2025-06-29 03:46:08 +02:00

bugfix: faster response after video stream restart.

This commit is contained in:
root 2014-03-27 01:00:45 +01:00
parent 7326835f39
commit c7ad0b69ab
7 changed files with 21 additions and 11 deletions

View file

@ -1,7 +1,7 @@
#include "checkvideo.h"
int connectionstate(char* remip, uint16_t remport)
int connectionstate(char* remip, uint16_t remport, uint32_t state)
{
FILE* tcpfile;
char line[256];
@ -15,9 +15,9 @@ int connectionstate(char* remip, uint16_t remport)
tcpfile = fopen("/proc/net/tcp","r");
while(fgets(line,256,tcpfile)){
sscanf(line, "%*u: %*x:%*x %x:%x %x", &remipi, &remporti, &statei);
if((inet_addr(remip)==remipi) & (remport==remporti)) {
if((inet_addr(remip)==remipi) & (remport==remporti) & (state==statei)) {
fclose(tcpfile);
return statei;
return 1;
}
}
fclose(tcpfile);
@ -27,6 +27,6 @@ int connectionstate(char* remip, uint16_t remport)
int checkvideo(char* remip, uint16_t remport)
{
if(0==remip[0]) return 2;
if(1==connectionstate(remip, remport)) return 1;
if(1==connectionstate(remip, remport, 1)) return 1;
return 0;
}