mirror of
https://github.com/FrodoVDR/UdpPipe.git
synced 2023-10-10 13:36:54 +02:00
Various bug fixes
+ fixed host name check + fixed error on stats + fixed reconnect problem on tail
This commit is contained in:
parent
24eb97f88d
commit
b9c2a13854
@ -191,9 +191,8 @@ class Head(PipeBase):
|
|||||||
(clientSocket, address) = self.pipeSocket.accept()
|
(clientSocket, address) = self.pipeSocket.accept()
|
||||||
if self.enableHostNameCheck:
|
if self.enableHostNameCheck:
|
||||||
data = socket.gethostbyname(self.tailHostname)
|
data = socket.gethostbyname(self.tailHostname)
|
||||||
ip = repr(data)
|
if address[0]!=data:
|
||||||
if address[0]!=ip:
|
self.log.warn("[Head] Connection attempt from wrong IP (%s but expected %s)" % (address[0], data))
|
||||||
self.log.warn("[Head] Connection attempt from wrong IP (%s but expected %s)" % (address[0], ip))
|
|
||||||
clientSocket.close()
|
clientSocket.close()
|
||||||
continue
|
continue
|
||||||
self.log.info("[Head] Connection from tail at %s:%d" % (address[0], address[1]))
|
self.log.info("[Head] Connection from tail at %s:%d" % (address[0], address[1]))
|
||||||
@ -335,7 +334,7 @@ class Head(PipeBase):
|
|||||||
ctlBuffer.close()
|
ctlBuffer.close()
|
||||||
break
|
break
|
||||||
now=datetime.datetime.now()
|
now=datetime.datetime.now()
|
||||||
if (now-lastReport).seconds>=3600:
|
if (now-lastReport).seconds>=(3600*24):
|
||||||
self.logStats(0, None)
|
self.logStats(0, None)
|
||||||
lastReport=now
|
lastReport=now
|
||||||
except socket.error as e:
|
except socket.error as e:
|
||||||
@ -453,7 +452,7 @@ class Tail(PipeBase):
|
|||||||
dataBuffer.close()
|
dataBuffer.close()
|
||||||
ctlBuffer.close()
|
ctlBuffer.close()
|
||||||
now=datetime.datetime.now()
|
now=datetime.datetime.now()
|
||||||
if (now-lastReport).seconds>=3600:
|
if (now-lastReport).seconds>=(3600*24):
|
||||||
self.logStats(0, None)
|
self.logStats(0, None)
|
||||||
lastReport=now
|
lastReport=now
|
||||||
continue
|
continue
|
||||||
@ -542,6 +541,7 @@ class Tail(PipeBase):
|
|||||||
servSocket.close()
|
servSocket.close()
|
||||||
self.connected=False
|
self.connected=False
|
||||||
time.sleep(Tail.WAIT4RETRY)
|
time.sleep(Tail.WAIT4RETRY)
|
||||||
|
servSocket=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
else:
|
else:
|
||||||
raise
|
raise
|
||||||
self.logStats(0, None)
|
self.logStats(0, None)
|
||||||
@ -591,6 +591,8 @@ class Tail(PipeBase):
|
|||||||
os.write(self.controlPipe[1], 'x')
|
os.write(self.controlPipe[1], 'x')
|
||||||
self.log.debug("[Tail] Received %d bytes from local address %s:%d" % (len(udpData), address[0], address[1]))
|
self.log.debug("[Tail] Received %d bytes from local address %s:%d" % (len(udpData), address[0], address[1]))
|
||||||
lastAction=datetime.datetime.now()
|
lastAction=datetime.datetime.now()
|
||||||
|
self.UDPBytesIn+=len(udpData)
|
||||||
|
self.packetsIn+=1
|
||||||
|
|
||||||
# upon exit we need to remove the queue object to avoid receiving more requests
|
# upon exit we need to remove the queue object to avoid receiving more requests
|
||||||
self.sourceIdLock.acquire()
|
self.sourceIdLock.acquire()
|
||||||
|
Loading…
Reference in New Issue
Block a user