[ZODB-Dev] [patch] 2 tiny patches for zeo clients and 1 for zeo storage server
Joseph Wayne Norton
norton@alum.mit.edu
Tue, 23 Oct 2001 10:10:09 +0900
Greg -
Here you go ... I will remember -c for next time.
- j
Index: ZEO/ClientStorage.py
===================================================================
RCS file: /cvs-repository/ZEO/ZEO/ClientStorage.py,v
retrieving revision 1.33.2.1
diff -c -r1.33.2.1 ClientStorage.py
*** ZEO/ClientStorage.py 7 Aug 2001 22:37:55 -0000 1.33.2.1
--- ZEO/ClientStorage.py 23 Oct 2001 01:07:44 -0000
***************
*** 119,142 ****
def __init__(self, connection, storage='1', cache_size=20000000,
name='', client='', debug=0, var=None,
! min_disconnect_poll=5, max_disconnect_poll=300,
wait_for_server_on_startup=1):
# Decide whether to use non-temporary files
! client=client or os.environ.get('ZEO_CLIENT','')
self._connection=connection
self._storage=storage
self._debug=debug
self._wait_for_server_on_startup=wait_for_server_on_startup
!
self._info={'length': 0, 'size': 0, 'name': 'ZEO Client',
'supportsUndo':0, 'supportsVersions': 0,
}
self._call=zrpc.asyncRPC(connection, debug=debug,
tmin=min_disconnect_poll,
! tmax=max_disconnect_poll)
name = name or str(connection)
--- 119,144 ----
def __init__(self, connection, storage='1', cache_size=20000000,
name='', client='', debug=0, var=None,
! min_disconnect_poll=5, max_disconnect_poll=300, min_disconnect_log=300,
wait_for_server_on_startup=1):
# Decide whether to use non-temporary files
! if client is not None:
! client=client or os.environ.get('ZEO_CLIENT','')
self._connection=connection
self._storage=storage
self._debug=debug
self._wait_for_server_on_startup=wait_for_server_on_startup
!
self._info={'length': 0, 'size': 0, 'name': 'ZEO Client',
'supportsUndo':0, 'supportsVersions': 0,
}
self._call=zrpc.asyncRPC(connection, debug=debug,
tmin=min_disconnect_poll,
! tmax=max_disconnect_poll,
! tmin_log=min_disconnect_log)
name = name or str(connection)
Index: ZEO/StorageServer.py
===================================================================
RCS file: /cvs-repository/ZEO/ZEO/StorageServer.py,v
retrieving revision 1.28.2.5
diff -c -r1.28.2.5 StorageServer.py
*** ZEO/StorageServer.py 19 Oct 2001 18:59:33 -0000 1.28.2.5
--- ZEO/StorageServer.py 23 Oct 2001 01:07:44 -0000
***************
*** 194,201 ****
def handle_accept(self):
try:
sock, addr = self.accept()
! except socket.error:
! sys.stderr.write('warning: accept failed\n')
else:
ZEOConnection(self, sock, addr)
--- 194,201 ----
def handle_accept(self):
try:
sock, addr = self.accept()
! except socket.error, why:
! sys.stderr.write('warning: accept failed - %s\n' % why)
else:
ZEOConnection(self, sock, addr)
Index: ZEO/zrpc.py
===================================================================
RCS file: /cvs-repository/ZEO/ZEO/zrpc.py,v
retrieving revision 1.18.2.4
diff -c -r1.18.2.4 zrpc.py
*** ZEO/zrpc.py 3 Oct 2001 12:58:07 -0000 1.18.2.4
--- ZEO/zrpc.py 23 Oct 2001 01:07:44 -0000
***************
*** 115,124 ****
__haveMainLoop=0
def __Wakeup(*args): pass
! def __init__(self, connection, outOfBand=None, tmin=5, tmax=300, debug=0):
self._connection=connection
self._outOfBand=outOfBand
! self._tmin, self._tmax = tmin, tmax
self._debug=debug
self.__closed = 0
--- 115,125 ----
__haveMainLoop=0
def __Wakeup(*args): pass
! def __init__(self, connection, outOfBand=None, tmin=5, tmax=300, tmin_log=300, debug=0):
self._connection=connection
self._outOfBand=outOfBand
! self._tmin, self._tmax, = tmin, tmax
! self._tmin_log, self._last_tmin_log = tmin_log, 0
self._debug=debug
self.__closed = 0
***************
*** 137,144 ****
connection = self._connection
debug=self._debug
while self.__closed == 0:
! if log_type: LOG(log_type, INFO,
! 'Trying to connect to server: %s' % `connection`)
try:
if type(connection) is type(''):
s=socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
--- 138,149 ----
connection = self._connection
debug=self._debug
while self.__closed == 0:
! if log_type:
! now = time.time()
! if (now - self._last_tmin_log) > self._tmin_log:
! self._last_tmin_log = now
! LOG(log_type, INFO,
! 'Trying to connect to server: %s' % `connection`)
try:
if type(connection) is type(''):
s=socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)