Commit e76f9f9a authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 489e4f2d
......@@ -370,14 +370,16 @@ class tWatch:
def __init__(t, tdb):
t.tdb = tdb
# open new head/watch handle.
#
# python/stdio lock file object on read/write
# however we need both read and write to be working simultaneously.
# -> we use 2 separate file objects for rx and tx.
#
# fdopen takes ownership of file descriptor and closes it when file
# object is closed -> we dup fd so that each file object has its own fd.
wh = os.open(tdb.path("head/watch"), os.O_RDWR)
wh2 = os.dup(wh) # XXX temp?
wh2 = os.dup(wh)
t.wrx = os.fdopen(wh, 'rb')
t.wtx = os.fdopen(wh2, 'wb')
......@@ -395,7 +397,10 @@ class tWatch:
def close(t):
t.tdb._tracked.remove(t)
t._send(1, b'bye') # ask wcfs to close its tx & rx sides; close(wcfs.tx) wakes up _serveRecv
# ask wcfs to close its tx & rx sides; close(wcfs.tx) wakes up
# _serveRecv on client (= on us).
t._send(1, b'bye')
t._serveDone.recv()
t.wtx.close()
......
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