Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
ftl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nicolas Pope
ftl
Commits
5edd21d9
Commit
5edd21d9
authored
5 years ago
by
Nicolas Pope
Browse files
Options
Downloads
Patches
Plain Diff
Only check first msg on connecting
parent
0b76aafe
No related branches found
No related tags found
1 merge request
!100
Resolves #163 garbage segfault
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
components/net/cpp/src/dispatcher.cpp
+3
-3
3 additions, 3 deletions
components/net/cpp/src/dispatcher.cpp
components/net/cpp/src/peer.cpp
+3
-4
3 additions, 4 deletions
components/net/cpp/src/peer.cpp
with
6 additions
and
7 deletions
components/net/cpp/src/dispatcher.cpp
+
3
−
3
View file @
5edd21d9
...
...
@@ -65,15 +65,15 @@ void ftl::net::Dispatcher::dispatch_call(Peer &s, const msgpack::object &msg) {
// assert(type == 0);
if
(
type
==
1
)
{
LOG
(
INFO
)
<<
"RPC return for "
<<
id
;
//D
LOG(INFO) << "RPC return for " << id;
s
.
_dispatchResponse
(
id
,
args
);
}
else
if
(
type
==
0
)
{
LOG
(
INFO
)
<<
"RPC "
<<
name
<<
"() <- "
<<
s
.
getURI
();
//D
LOG(INFO) << "RPC " << name << "() <- " << s.getURI();
auto
func
=
_locateHandler
(
name
);
if
(
func
)
{
LOG
(
INFO
)
<<
"Found binding for "
<<
name
;
//D
LOG(INFO) << "Found binding for " << name;
try
{
auto
result
=
(
*
func
)(
args
);
//->get();
s
.
_sendResponse
(
id
,
result
->
get
());
...
...
This diff is collapsed.
Click to expand it.
components/net/cpp/src/peer.cpp
+
3
−
4
View file @
5edd21d9
...
...
@@ -514,11 +514,11 @@ bool Peer::_data() {
_data
();
});
if
(
status_
!
=
kConnect
ed
)
{
if
(
status_
=
=
kConnect
ing
)
{
// If not connected, must lock to make sure no other thread performs this step
UNIQUE_LOCK
(
recv_mtx_
,
lk
);
// Verify still not connected after lock
if
(
status_
!
=
kConnect
ed
)
{
if
(
status_
=
=
kConnect
ing
)
{
// First message must be a handshake
try
{
tuple
<
uint32_t
,
std
::
string
,
msgpack
::
object
>
hs
;
...
...
@@ -554,7 +554,7 @@ void Peer::_dispatchResponse(uint32_t id, msgpack::object &res) {
// TODO: Handle error reporting...
UNIQUE_LOCK
(
cb_mtx_
,
lk
);
if
(
callbacks_
.
count
(
id
)
>
0
)
{
DLOG
(
1
)
<<
"Received return RPC value"
;
//
DLOG(1) << "Received return RPC value";
// Allow for unlock before callback
auto
cb
=
std
::
move
(
callbacks_
[
id
]);
...
...
@@ -576,7 +576,6 @@ void Peer::cancelCall(int id) {
}
void
Peer
::
_sendResponse
(
uint32_t
id
,
const
msgpack
::
object
&
res
)
{
LOG
(
INFO
)
<<
"Sending response: "
<<
id
;
Dispatcher
::
response_t
res_obj
=
std
::
make_tuple
(
1
,
id
,
std
::
string
(
""
),
res
);
UNIQUE_LOCK
(
send_mtx_
,
lk
);
if
(
scheme_
==
ftl
::
URI
::
SCHEME_WS
)
send_buf_
.
append_ref
(
nullptr
,
0
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment