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
310b2283
Commit
310b2283
authored
May 07, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
fac36e13
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
9 deletions
+25
-9
wcfs/test.sh
wcfs/test.sh
+1
-1
wcfs/wcfs.go
wcfs/wcfs.go
+1
-0
wcfs/wcfs_test.py
wcfs/wcfs_test.py
+23
-8
No files found.
wcfs/test.sh
View file @
310b2283
...
@@ -10,7 +10,7 @@ fi
...
@@ -10,7 +10,7 @@ fi
# executed under qemu-runlinux
# executed under qemu-runlinux
#export WENDELIN_CORE_WCFS_OPTIONS="-d -alsologtostderr -v=1"
#export WENDELIN_CORE_WCFS_OPTIONS="-d -alsologtostderr -v=1"
py.test
\
py.test
\
`
# diable cache & warnings that it cannot be updated since fs under qrun is read-only` \
`
# di
s
able cache & warnings that it cannot be updated since fs under qrun is read-only` \
`
# https://stackoverflow.com/a/47893653/9456786` \
`
# https://stackoverflow.com/a/47893653/9456786` \
-p
no:cacheprovider
\
-p
no:cacheprovider
\
\
\
...
...
wcfs/wcfs.go
View file @
310b2283
...
@@ -1486,6 +1486,7 @@ func (wlink *WatchLink) _serveRX() (err error) {
...
@@ -1486,6 +1486,7 @@ func (wlink *WatchLink) _serveRX() (err error) {
}
}
e2
:=
wlink
.
sk
.
Close
()
e2
:=
wlink
.
sk
.
Close
()
fmt
.
Printf
(
"S: wlink %d: sk.close -> %v
\n
"
,
wlink
.
id
,
e2
)
if
e
==
nil
{
if
e
==
nil
{
e
=
e2
e
=
e2
}
}
...
...
wcfs/wcfs_test.py
View file @
310b2283
...
@@ -421,21 +421,25 @@ class tWatch:
...
@@ -421,21 +421,25 @@ class tWatch:
t
.
_txmu
=
threading
.
Lock
()
# serializes writes
t
.
_txmu
=
threading
.
Lock
()
# serializes writes
t
.
_serveDone
=
chan
()
serveCtx
,
t
.
_serveCancel
=
context
.
with_cancel
(
context
.
background
())
go
(
t
.
_serveRecv
)
t
.
_serveWG
=
sync
.
WorkGroup
(
serveCtx
)
t
.
_serveWG
.
go
(
t
.
_serveRecv
)
tdb
.
_tracked
.
add
(
t
)
tdb
.
_tracked
.
add
(
t
)
def
close
(
t
):
def
close
(
t
):
t
.
tdb
.
_tracked
.
remove
(
t
)
t
.
tdb
.
_tracked
.
remove
(
t
)
t
.
_serveCancel
()
# ask wcfs to close its tx & rx sides; close(wcfs.tx) wakes up
# ask wcfs to close its tx & rx sides; close(wcfs.tx) wakes up
# _serveRecv on client (= on us).
# _serveRecv on client (= on us).
t
.
_send
(
1
,
b'bye'
)
t
.
_send
(
1
,
b'bye'
)
# XXX we can get stuck here if wcfs does not behave as we want.
# XXX we can get stuck here if wcfs does not behave as we want.
# XXX in particular if there is a silly - e.g. syntax or type error in
# XXX in particular if there is a silly - e.g. syntax or type error in
# test code - we curently get stuck here.
# test code - we curently get stuck here.
t
.
_serveDone
.
recv
()
print
(
'# serveDone.recv() ...'
)
t
.
_serveWG
.
wait
()
print
(
'# serveDone ready'
)
t
.
wtx
.
close
()
t
.
wtx
.
close
()
t
.
wrx
.
close
()
t
.
wrx
.
close
()
...
@@ -450,9 +454,9 @@ class tWatch:
...
@@ -450,9 +454,9 @@ class tWatch:
# _serveRecv receives messages from .w and dispatches them according to streamID.
# _serveRecv receives messages from .w and dispatches them according to streamID.
@
func
@
func
def
_serveRecv
(
t
):
def
_serveRecv
(
t
,
ctx
):
defer
(
t
.
_serveDone
.
close
)
while
1
:
while
1
:
print
(
'C: watch : rx wait ...'
)
l
=
t
.
wrx
.
readline
()
l
=
t
.
wrx
.
readline
()
print
(
'C: watch : rx: %r'
%
l
)
print
(
'C: watch : rx: %r'
%
l
)
if
len
(
l
)
==
0
:
if
len
(
l
)
==
0
:
...
@@ -468,12 +472,23 @@ class tWatch:
...
@@ -468,12 +472,23 @@ class tWatch:
with
t
.
_rxmu
:
with
t
.
_rxmu
:
assert
stream
in
t
.
_rxtab
assert
stream
in
t
.
_rxtab
rxq
=
t
.
_rxtab
.
pop
(
stream
)
rxq
=
t
.
_rxtab
.
pop
(
stream
)
rxq
.
send
(
msg
)
_
,
_rx
=
select
(
ctx
.
done
().
recv
,
# 0
(
rxq
.
send
,
msg
),
# 1
)
if
_
==
0
:
raise
ctx
.
err
()
# XXX ok? -> or just return?
else
:
else
:
with
t
.
_rxmu
:
with
t
.
_rxmu
:
assert
stream
not
in
t
.
_accepted
assert
stream
not
in
t
.
_accepted
t
.
_accepted
.
add
(
stream
)
t
.
_accepted
.
add
(
stream
)
t
.
_acceptq
.
send
((
stream
,
msg
))
_
,
_rx
=
select
(
ctx
.
done
().
recv
,
# 0
(
t
.
_acceptq
.
send
,
(
stream
,
msg
)),
# 1
)
if
_
==
0
:
raise
ctx
.
err
()
# XXX ok? -> or just return?
# _send sends raw message via specified stream.
# _send sends raw message via specified stream.
#
#
...
@@ -657,9 +672,9 @@ def test_wcfs():
...
@@ -657,9 +672,9 @@ def test_wcfs():
# XXX invalidation protocol ...
# XXX invalidation protocol ...
print
(
'
\
n
\
n
inv. protocol
\
n
\
n
'
)
print
(
'
\
n
\
n
inv. protocol
\
n
\
n
'
)
"""
w = t.openwatch()
w = t.openwatch()
"""
ctx = context.background() # XXX stub
ctx = context.background() # XXX stub
wg = sync.WorkGroup(ctx)
wg = sync.WorkGroup(ctx)
...
...
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