Commit 8b16fc79 authored by Jim Fulton's avatar Jim Fulton

Added sync method in support of the ZODB Connection sync method.

parent 1cc1e605
......@@ -84,7 +84,7 @@
##############################################################################
"""Network ZODB storage client
"""
__version__='$Revision: 1.25 $'[11:-2]
__version__='$Revision: 1.26 $'[11:-2]
import struct, time, os, socket, string, Sync, zrpc, ClientCache
import tempfile, Invalidator, ExtensionClass, thread
......@@ -559,6 +559,8 @@ class ClientStorage(ExtensionClass.Base, BaseStorage.BaseStorage):
try: return self._call('versions', max)
finally: self._lock_release()
def sync(self): self._call.sync()
def getWakeup(_w=[]):
if _w: return _w[0]
import trigger
......
......@@ -85,13 +85,13 @@
"""Simple rpc mechanisms
"""
__version__ = "$Revision: 1.10 $"[11:-2]
__version__ = "$Revision: 1.11 $"[11:-2]
from ZODB.cPickle import loads
from ZODB import cPickle
from thread import allocate_lock
from smac import SizedMessageAsyncConnection
import socket, string, struct, asyncore, sys, time
import socket, string, struct, asyncore, sys, time, select
TupleType=type(())
from zLOG import LOG, TRACE, DEBUG, INFO
......@@ -163,6 +163,17 @@ class asyncRPC(SizedMessageAsyncConnection):
if key==self._fileno: return self
raise KeyError, key
def sync(self):
if self.__map: return # in async mode
# Ick, I have to do my own select loop, which sucks
while 1:
try: r, w, e = select.select([self._fileno],[],[],0.0)
except select.error, v:
if v[0] != EINTR: raise
if r: asyncore.poll(0.0, self)
else: break
def readLoop(self):
la=self.__la
while not la(0):
......@@ -176,6 +187,7 @@ class asyncRPC(SizedMessageAsyncConnection):
self.__map=1
self.__Wakeup=Wakeup
def __call__(self, *args):
args=dump(args,1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment