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
d61e9df9
Commit
d61e9df9
authored
Oct 29, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
d91b8f64
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
8 deletions
+22
-8
wcfs/internal/wcfs_misc.cpp
wcfs/internal/wcfs_misc.cpp
+4
-0
wcfs/internal/wcfs_misc.h
wcfs/internal/wcfs_misc.h
+1
-0
wcfs/internal/wcfs_virtmem.cpp
wcfs/internal/wcfs_virtmem.cpp
+17
-8
No files found.
wcfs/internal/wcfs_misc.cpp
View file @
d61e9df9
...
...
@@ -199,6 +199,10 @@ error errorf(const char *format, ...) {
// strings::
namespace
strings
{
bool
has_prefix
(
const
string
&
s
,
const
string
&
prefix
)
{
return
s
.
compare
(
0
,
prefix
.
size
(),
prefix
);
}
vector
<
string
>
split
(
const
string
&
s
,
char
sep
)
{
vector
<
string
>
r
;
int
psep_prev
=-
1
,
psep
;
...
...
wcfs/internal/wcfs_misc.h
View file @
d61e9df9
...
...
@@ -143,6 +143,7 @@ error errorf (const char *format, ...)
// strings::
namespace
strings
{
bool
has_prefix
(
const
string
&
s
,
const
string
&
prefix
);
vector
<
string
>
split
(
const
string
&
s
,
char
sep
);
}
// strings::
...
...
wcfs/internal/wcfs_virtmem.cpp
View file @
d61e9df9
...
...
@@ -663,7 +663,7 @@ tuple</*rxq*/chan<rxPkt>, error> WatchLink::_sendReq(IContext *ctx, const string
}
// recvReq receives client <- server request.
error
WatchLink
::
recvReq
(
IContext
*
ctx
,
PinReq
*
rx
)
{
error
WatchLink
::
recvReq
(
IContext
*
ctx
,
PinReq
*
p
rx
)
{
WatchLink
&
wlink
=
*
this
;
rxPkt
pkt
;
...
...
@@ -680,18 +680,27 @@ error WatchLink::recvReq(IContext *ctx, PinReq *rx) {
return rx
#endif
rx
->
stream
=
pkt
.
stream
;
pkt
.
to_string
();
stream
,
msg
=
rx
// XXX -> _parsePinReq
return
PinReq
(
wlink
,
stream
,
msg
)
err
=
_parsePinReq
(
prx
,
&
pkt
);
return
err
;
}
// _parsePinReq parses message into PinReq according to wcfs invalidation protocol.
error
_parsePinReq
(
PinReq
*
out
,
const
string
&
msg
)
{
error
_parsePinReq
(
PinReq
*
pin
,
const
rxPkt
*
pkt
)
{
// XXX err ctx "bad pin"
pin
->
stream
=
pkt
->
stream
;
// pin <foid>) #<blk> @<at>
msgv
=
strings
::
split
(
msg
,
' '
);
if
if
(
!
strings
::
has_prefix
(
msg
,
"pin "
))
return
fmt
::
errorf
(
"not a pin request"
);
// XXX +msg?
argv
=
strings
::
split
(
msg
.
substr
(
4
),
' '
);
if
(
msgv
.
len
()
!=
3
)
return
fmt
::
errorf
(
"expected 3 arguments, got %d"
,
msgv
.
len
());
// XXX
return
nil
;
}
// _readline reads next raw line sent from wcfs.
...
...
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