Commit 93329980 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent aa3a9abf
...@@ -113,7 +113,6 @@ cdef public class _ZBigFile(BigFile) [object _ZBigFile, type _ZBigFile_Type]: ...@@ -113,7 +113,6 @@ cdef public class _ZBigFile(BigFile) [object _ZBigFile, type _ZBigFile_Type]:
if zf.wfileh == nil: if zf.wfileh == nil:
zconn = zf.zself._p_jar zconn = zf.zself._p_jar
assert zconn is not None assert zconn is not None
# XXX locking? or rely on that ZODB objects for zconn must be used from under 1 thread only?
# join zconn to wconn; link to wconn from _ZBigFile # join zconn to wconn; link to wconn from _ZBigFile
pywconn = pywconnOf(zconn) pywconn = pywconnOf(zconn)
...@@ -127,14 +126,14 @@ cdef public class _ZBigFile(BigFile) [object _ZBigFile, type _ZBigFile_Type]: ...@@ -127,14 +126,14 @@ cdef public class _ZBigFile(BigFile) [object _ZBigFile, type _ZBigFile_Type]:
# pywconnOf establishes and returns (py) wcfs.Conn associated with zconn. # pywconnOf establishes and returns (py) wcfs.Conn associated with zconn.
# #
# returned wcfs.Conn will be maintained to keep in sync with zconn. # returned wcfs.Conn will be maintained to keep in sync with zconn, and will be
# closed when zconn is destroyed.
# #
# XXX closed on zconn dealloc ? # It is invalid to make simultaneous calls to pywconnOf with the same zconn.
# XXX simultaneous call? # (in ZODB/py objects for zconn must be used from under 1 thread only).
# XXX move -> .py ?
cdef wcfs.PyConn pywconnOf(zconn): cdef wcfs.PyConn pywconnOf(zconn):
assert isinstance(zconn, ZConnection) assert isinstance(zconn, ZConnection)
assert zconn.opened # XXX needed? assert zconn.opened
# XXX locking # XXX locking
wconn = getattr(zconn, '_wcfs_wconn', None) wconn = getattr(zconn, '_wcfs_wconn', None)
...@@ -164,8 +163,7 @@ class ZSync: ...@@ -164,8 +163,7 @@ class ZSync:
# .wconn (py) wcfs.Connection # .wconn (py) wcfs.Connection
def __init__(zsync, zconn, wconn): def __init__(zsync, zconn, wconn):
#print('ZSync %r %r' % (zconn, wconn)) assert zconn.opened
assert zconn.open
zsync.wconn = wconn zsync.wconn = wconn
zsync.zconn_ref = weakref.ref(zconn, zsync.on_zconn_dealloc) zsync.zconn_ref = weakref.ref(zconn, zsync.on_zconn_dealloc)
...@@ -183,7 +181,5 @@ class ZSync: ...@@ -183,7 +181,5 @@ class ZSync:
# DB resyncs .zconn onto new database view. # DB resyncs .zconn onto new database view.
# -> resync .wconn to updated database view of ZODB connection. # -> resync .wconn to updated database view of ZODB connection.
def on_connection_resync(zsync): def on_connection_resync(zsync):
#print('\nZZZSync.resync %r %r' % (zsync.zconn, zsync.wconn))
#import traceback; traceback.print_stack()
zconn = zsync.zconn_ref() zconn = zsync.zconn_ref()
zsync.wconn.resync(zconn_at(zconn)) zsync.wconn.resync(zconn_at(zconn))
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