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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Joshua
wendelin.core
Commits
e32e463b
Commit
e32e463b
authored
Feb 19, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
167b42ee
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
13 deletions
+18
-13
wcfs/client/wcfs.cpp
wcfs/client/wcfs.cpp
+18
-13
No files found.
wcfs/client/wcfs.cpp
View file @
e32e463b
...
@@ -126,37 +126,42 @@ error _Conn::close() {
...
@@ -126,37 +126,42 @@ error _Conn::close() {
xerr
::
Contextf
E
(
"%s: close"
,
v
(
wconn
));
xerr
::
Contextf
E
(
"%s: close"
,
v
(
wconn
));
// xerr::Contextf E("wcfs %s: close %s", v(wconn._wc->mountpoint), v(wconn.at));
// XXX + conn # e.g. from wconn._wlink.id? or wlink.close should include its id itself?
// (or ._wlink._f.fd() ?)
error
err
,
eret
;
error
err
,
eret
;
auto
reterr1
=
[
&
eret
](
error
err
)
{
auto
reterr1
=
[
&
eret
](
error
err
)
{
if
(
eret
==
nil
&&
err
!=
nil
)
if
(
eret
==
nil
&&
err
!=
nil
)
eret
=
err
;
eret
=
err
;
};
};
bool
alreadyClosed
=
false
;
wconn
.
_mu
.
lock
();
wconn
.
_mu
.
lock
();
defer
([
&
]()
{
alreadyClosed
=
(
wconn
.
_downErr
==
errConnClosed
);
wconn
.
_mu
.
unlock
()
;
wconn
.
_downErr
=
errConnClosed
;
}
);
wconn
.
_mu
.
unlock
(
);
if
(
alreadyClosed
)
wconn
.
_downErr
=
errConnClosed
;
// XXX ok to change even if it was !nil before?
return
nil
;
err
=
wconn
.
_wlink
->
close
();
// XXX ok under mu?
// close wlink and signal to pinner to stop outside of wconn.mu
err
=
wconn
.
_wlink
->
close
();
// XXX ok under atMu?
if
(
err
!=
nil
)
if
(
err
!=
nil
)
reterr1
(
err
);
reterr1
(
err
);
wconn
.
_pinCancel
();
wconn
.
_pinCancel
();
err
=
wconn
.
_pinWG
->
wait
();
// XXX ok under
m
u?
err
=
wconn
.
_pinWG
->
wait
();
// XXX ok under
atM
u?
if
(
!
errors
::
Is
(
err
,
context
::
canceled
))
// canceled - ok
if
(
!
errors
::
Is
(
err
,
context
::
canceled
))
// canceled - ok
reterr1
(
err
);
reterr1
(
err
);
// close all files - both that have no mappings and that still have opened mappings.
// pinner is stopped - now close all files - both that have no mappings and
// that still have opened mappings.
//
//
// NOTE after file is closed mappings could continue to survive, but we can no
// NOTE after file is closed mappings could continue to survive, but we can no
// longer maintain consistent view. For this reason we change mappings to
// longer maintain consistent view. For this reason we change mappings to
// something that gives EFAULT on access. XXX implement
// something that gives EFAULT on access. XXX implement
wconn
.
_mu
.
lock
();
defer
([
&
]()
{
wconn
.
_mu
.
unlock
();
});
// XXX f locking
for
(
auto
_
:
wconn
.
_filehTab
)
{
for
(
auto
_
:
wconn
.
_filehTab
)
{
auto
f
=
_
.
second
;
auto
f
=
_
.
second
;
err
=
f
->
_headf
->
close
();
// XXX mark fileh as down so that fileh.close does not say "bad fd"
err
=
f
->
_headf
->
close
();
// XXX mark fileh as down so that fileh.close does not say "bad fd"
...
@@ -211,7 +216,7 @@ error _Conn::__pinner(context::Context ctx) {
...
@@ -211,7 +216,7 @@ error _Conn::__pinner(context::Context ctx) {
if
(
err
!=
nil
)
{
if
(
err
!=
nil
)
{
// it is ok if we receive EOF due to us closing the connection
// it is ok if we receive EOF due to us closing the connection
if
(
err
==
io
::
EOF_
)
{
if
(
err
==
io
::
EOF_
)
{
wconn
.
_mu
.
lock
();
wconn
.
_mu
.
lock
();
// <- XXX
err
=
(
wconn
.
_downErr
==
errConnClosed
)
?
nil
:
io
::
ErrUnexpectedEOF
;
err
=
(
wconn
.
_downErr
==
errConnClosed
)
?
nil
:
io
::
ErrUnexpectedEOF
;
wconn
.
_mu
.
unlock
();
wconn
.
_mu
.
unlock
();
}
}
...
...
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