Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
f077ed67
Commit
f077ed67
authored
Feb 19, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
d55fddd6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
7 deletions
+15
-7
wcfs/client/wcfs.cpp
wcfs/client/wcfs.cpp
+15
-7
No files found.
wcfs/client/wcfs.cpp
View file @
f077ed67
...
...
@@ -149,7 +149,6 @@ error _Conn::close() {
if
(
!
errors
::
Is
(
err
,
context
::
canceled
))
// canceled - ok
reterr1
(
err
);
// pinner is stopped - now close all files - both that have no mappings and
// that still have opened mappings.
//
...
...
@@ -194,9 +193,9 @@ error _Conn::_pinner(context::Context ctx) {
}
// mark the connection non-operational if the pinner fails
wconn
.
_mu
.
lock
();
// XXX locking ok? -> merge into below where lock is held?
XXX + atMu.R ?
wconn
.
_mu
.
lock
();
// XXX locking ok? -> merge into below where lock is held?
if
(
wconn
.
_downErr
==
nil
)
{
wconn
.
_downErr
=
fmt
::
errorf
(
"no longer operational due to: %w"
,
err
);
wconn
.
_downErr
=
fmt
::
errorf
(
"no longer operational due to: %w"
,
err
);
// XXX err=nil ?
// XXX make all fileh and mapping invalid.
}
wconn
.
_mu
.
unlock
();
...
...
@@ -335,10 +334,13 @@ error _Conn::__pin1(PinReq *req) {
pair
<
FileH
,
error
>
_Conn
::
open
(
zodb
::
Oid
foid
)
{
_Conn
&
wconn
=
*
this
;
error
err
;
xerr
::
Contextf
E
(
"%s: open f<%s>"
,
v
(
wconn
),
v
(
foid
));
// XXX wconn._atMu.RLock()
// XXX defer wconn._atMu.RUnlock()
wconn
.
_atMu
.
RLock
();
defer
([
&
]()
{
wconn
.
_atMu
.
RUnlock
();
});
xerr
::
Contextf
E
(
"%s: open f<%s>"
,
v
(
wconn
),
v
(
foid
));
wconn
.
_mu
.
lock
();
...
...
@@ -361,6 +363,7 @@ pair<FileH, error> _Conn::open(zodb::Oid foid) {
}
// create in-flight-opening FileH entry and perform open with wconn._mu released
// NOTE wconn._atMu is still held because open relies on wconn.at being stable.
f
=
adoptref
(
new
_FileH
());
f
->
wconn
=
newref
(
&
wconn
);
f
->
foid
=
foid
;
...
...
@@ -388,6 +391,11 @@ pair<FileH, error> _Conn::open(zodb::Oid foid) {
}
// _open performs actual open of FileH marked as "in-flight-open" in wconn.filehTab.
//
// Called with:
// - wconn.atMu held
// - wconn.mu not locked
// - f.mu not locked
error
_FileH
::
_open
()
{
_FileH
*
f
=
this
;
Conn
wconn
=
f
->
wconn
;
...
...
@@ -415,7 +423,7 @@ error _FileH::_open() {
v
(
f
->
_headf
->
name
()),
f
->
_headfsize
,
f
->
blksize
);
// start watching f
// NOTE we are _not_ holding wconn.mu nor f.mu
XXX wconn.atMu?
// NOTE we are _not_ holding wconn.mu nor f.mu
- only wconn.atMu to rely on wconn.at being stable.
string
ack
;
tie
(
ack
,
err
)
=
wconn
->
_wlink
->
sendReq
(
context
::
background
(),
fmt
::
sprintf
(
"watch %s @%s"
,
v
(
foid
),
v
(
wconn
->
at
)));
if
(
err
!=
nil
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment