Commit 8a5e3d10 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 18cf8955
...@@ -1411,18 +1411,16 @@ func (wlink *WatchLink) setupWatch(ctx context.Context, foid zodb.Oid, at zodb.T ...@@ -1411,18 +1411,16 @@ func (wlink *WatchLink) setupWatch(ctx context.Context, foid zodb.Oid, at zodb.T
defer head.zheadMu.RUnlock() defer head.zheadMu.RUnlock()
headAt := head.zconn.At() headAt := head.zconn.At()
if at < bfdir.δFtail.Tail() { if at != zodb.InvalidTid && at < bfdir.δFtail.Tail() {
return fmt.Errorf("too far away back from head/at (@%s); δt = %s", return fmt.Errorf("too far away back from head/at (@%s); δt = %s",
headAt, headAt.Time().Sub(at.Time().Time)) headAt, headAt.Time().Sub(at.Time().Time))
} }
// XXX if watch was already established - we need to update it // if watch was already established - we need to update it
// XXX locking (.byfile) w := wlink.byfile[foid] // XXX locking
w := wlink.byfile[foid]
if w == nil { if w == nil {
// watch was not previously established - set it up anew // watch was not previously established - set it up anew
// XXX locking (.fileTab) f := bfdir.fileTab[foid] // XXX locking
f := bfdir.fileTab[foid]
if f == nil { if f == nil {
// by "invalidation protocol" watch is setup after data file was opened // by "invalidation protocol" watch is setup after data file was opened
return fmt.Errorf("file not yet known to wcfs or is not a ZBigFile") return fmt.Errorf("file not yet known to wcfs or is not a ZBigFile")
...@@ -1437,10 +1435,9 @@ func (wlink *WatchLink) setupWatch(ctx context.Context, foid zodb.Oid, at zodb.T ...@@ -1437,10 +1435,9 @@ func (wlink *WatchLink) setupWatch(ctx context.Context, foid zodb.Oid, at zodb.T
} }
// at="-" (InvalidTid) means "remove the watch" // at="-" (InvalidTid) means "remove the watch"
// XXX locking
if at == zodb.InvalidTid { if at == zodb.InvalidTid {
delete(wlink.byfile, foid) delete(wlink.byfile, foid) // XXX locking
delete(w.file.watchTab, w) delete(w.file.watchTab, w) // XXX locking
return nil return nil
} }
......
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