- Use pickle instead of cPickle. Python 2.5 gives an exception with cPickle

- Use a binary format instead of ASCII

git-svn-id: https://fail2ban.svn.sourceforge.net/svnroot/fail2ban/trunk@443 a942ae1a-1317-0410-a47c-b1dcaea8d605
0.x
Cyril Jaquier 18 years ago
parent 9834734178
commit d065d97888

@ -24,6 +24,8 @@ ver. 0.7.4 (2006/??/??) - beta
Python
- Better debugging output for "fail2ban-regex"
- Added support for more date format
- cPickle does not work with Python 2.5. Use pickle instead
(performance is not a problem in our case)
ver. 0.7.3 (2006/09/28) - beta
----------

@ -13,6 +13,8 @@ Legend:
# partially done
* done
- Fix the cPickle issue with Python 2.5
- Multiline log reading
- Improve communication. (asyncore, asynchat??)

@ -24,7 +24,8 @@ __date__ = "$Date$"
__copyright__ = "Copyright (c) 2004 Cyril Jaquier"
__license__ = "GPL"
from cPickle import dumps, loads
#from cPickle import dumps, loads, HIGHEST_PROTOCOL
from pickle import dumps, loads, HIGHEST_PROTOCOL
import socket
class CSocket:
@ -40,7 +41,7 @@ class CSocket:
def send(self, msg):
# Convert every list member to string
obj = dumps(map(str, msg))
obj = dumps(map(str, msg), HIGHEST_PROTOCOL)
self.__csock.send(obj + CSocket.END_STRING)
ret = self.receive(self.__csock)
self.__csock.close()

@ -25,7 +25,9 @@ __copyright__ = "Copyright (c) 2004 Cyril Jaquier"
__license__ = "GPL"
from threading import Thread
from cPickle import dumps, loads
# cPickle generates an exception with Python 2.5
#from cPickle import dumps, loads, HIGHEST_PROTOCOL
from pickle import dumps, loads, HIGHEST_PROTOCOL
import socket, logging, os, os.path
# Gets the instance of the logger.
@ -113,7 +115,7 @@ class SocketWorker(Thread):
@staticmethod
def __send(sock, msg):
obj = dumps(msg)
obj = dumps(msg, HIGHEST_PROTOCOL)
sock.send(obj + SSocket.END_STRING)
@staticmethod

Loading…
Cancel
Save