Commit 35fec6c6 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent c6da1a38
......@@ -114,6 +114,8 @@ struct Conn {
sync::Mutex _filemu;
dict<Oid, _File*> _filetab; // {} foid -> _file
error close();
private:
void _pinner(IContext *ctx);
void _pin1(PinReq *req);
......@@ -257,28 +259,37 @@ tuple<Conn*, error> WCFS::connect(Tid at) {
// close releases resources associated with wconn.
// XXX what happens to file mmappings?
error Conn::close(wconn) {
error Conn::close() { // XXX error -> void?
Conn &wconn = *this;
wconn._wlink.close();
wconn._wlink->close(); // XXX err
#if 0
wconn._pinCancel()
try:
wconn._pinWG.wait()
except Exception as e: # canceled - ok
except Exception as e: // canceled - ok
if e is not context.canceled:
raise
#endif
// close all files - both that have no mappings and that still have opened mappings.
// XXX after file is closed mappings continue to survive, but we can no
// longer maintain consistent view.
with wconn._filemu:
for f in wconn._filetab.values():
f.headf.close()
f.headf = None
wconn._filemu.lock();
defer([&]() {
wconn._filemu.unlock();
});
# XXX stop watching f
for (auto _ : wconn._filetab) {
auto f = _.second;
f->headf.close(); // XXX err
//f->headf = None
// XXX stop watching f
}
wconn._filetab = None
wconn._filetab.clear();
return nil; // XXX -> err ?
}
// _pinner receives pin messages from wcfs and adjusts wconn mappings.
......@@ -498,8 +509,8 @@ error WatchLink::_serveRX(IContext *ctx) { // XXX error -> where ?
wlink._rxmu.lock();
wlink._rxdown = true; // don't allow new rxtab registers
wlink._rxmu.unlock();
for (auto rxqi : wlink._rxtab) {
auto rxq = rxqi.second;
for (auto _ : wlink._rxtab) {
auto rxq = _.second;
rxq.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