mirror of https://github.com/fail2ban/fail2ban
- Catched socket.error raised by socket.accept on some platform
- Modified some socket settings git-svn-id: https://fail2ban.svn.sourceforge.net/svnroot/fail2ban/trunk@555 a942ae1a-1317-0410-a47c-b1dcaea8d6050.x
parent
0b9c41c015
commit
9cb7831758
|
@ -68,7 +68,7 @@ class SSocket(Thread):
|
|||
#self.__ssock.bind(("localhost", 2222))
|
||||
self.__ssock.bind(sock)
|
||||
# Become a server socket
|
||||
self.__ssock.listen(5)
|
||||
self.__ssock.listen(1)
|
||||
|
||||
def run(self):
|
||||
self.__isRunning = True
|
||||
|
@ -80,6 +80,9 @@ class SSocket(Thread):
|
|||
except socket.timeout:
|
||||
# Do nothing here
|
||||
pass
|
||||
except socket.error:
|
||||
# Do nothing here
|
||||
pass
|
||||
self.__ssock.close()
|
||||
# Remove socket
|
||||
if os.path.exists(self.__socket):
|
||||
|
@ -122,7 +125,7 @@ class SocketWorker(Thread):
|
|||
def __receive(sock):
|
||||
msg = ''
|
||||
while msg.rfind(SSocket.END_STRING) == -1:
|
||||
chunk = sock.recv(6)
|
||||
chunk = sock.recv(128)
|
||||
if chunk == '':
|
||||
raise RuntimeError, "socket connection broken"
|
||||
msg = msg + chunk
|
||||
|
|
Loading…
Reference in New Issue