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
12315d18
Commit
12315d18
authored
Feb 21, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
a634a113
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
3 deletions
+11
-3
wcfs/client/wcfs.cpp
wcfs/client/wcfs.cpp
+8
-2
wcfs/client/wcfs.h
wcfs/client/wcfs.h
+3
-1
No files found.
wcfs/client/wcfs.cpp
View file @
12315d18
...
...
@@ -610,13 +610,16 @@ pair<FileH, error> _Conn::open(zodb::Oid foid) {
FileH
f
;
bool
ok
;
tie
(
f
,
ok
)
=
wconn
.
_filehTab
.
get_
(
foid
);
if
(
ok
)
{
f
->
_nopen
++
;
// XXX lock by f.mu ?
wconn
.
_mu
.
Unlock
();
f
->
_openReady
.
recv
();
if
(
f
->
_openErr
!=
nil
)
if
(
f
->
_openErr
!=
nil
)
{
// XXX lock/unlock wconn._mu around nopen-- ?
f
->
_nopen
--
;
return
make_pair
(
nil
,
E
(
f
->
_openErr
));
}
// XXX incref open count
return
make_pair
(
f
,
nil
);
}
...
...
@@ -630,12 +633,15 @@ pair<FileH, error> _Conn::open(zodb::Oid foid) {
f
->
_headf
=
nil
;
f
->
blksize
=
0
;
f
->
_headfsize
=
0
;
f
->
_nopen
=
1
;
f
->
_closed
=
false
;
bool
retok
=
false
;
wconn
.
_filehTab
[
foid
]
=
f
;
defer
([
&
]()
{
if
(
!
retok
)
{
wconn
.
_mu
.
Lock
();
f
->
_nopen
--
;
// XXX locking ok?
// XXX assert filehTab[foid] == f
wconn
.
_filehTab
.
erase
(
foid
);
wconn
.
_mu
.
Unlock
();
...
...
wcfs/client/wcfs.h
View file @
12315d18
...
...
@@ -181,7 +181,7 @@ struct _Conn : object {
sync
::
RWMutex
_atMu
;
zodb
::
Tid
at
;
sync
::
RWMutex
_mu
;
// _atMu.W | _atMu.R + _mu
sync
::
RWMutex
_mu
;
// _atMu.W | _atMu.R + _mu
XXX -> _filehMu ?
error
_downErr
;
// !nil if connection is closed or no longer operational
dict
<
zodb
::
Oid
,
FileH
>
_filehTab
;
// {} foid -> fileh
...
...
@@ -238,6 +238,8 @@ struct _FileH : object {
sync
::
Mutex
_mu
;
// atMu.W | atMu.R + _mu
dict
<
int64_t
,
zodb
::
Tid
>
_pinned
;
// {} blk -> rev that wcfs already sent us for this file
vector
<
Mapping
>
_mmaps
;
// []Mapping ↑blk_start mappings of this file
// XXX protect by wconn.mu ?
int
_nopen
;
// number of times Conn.open returned this fileh
bool
_closed
;
// y after .close()
...
...
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