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
28ae652a
Commit
28ae652a
authored
5 years ago
by
Nicolas Pope
Browse files
Options
Downloads
Patches
Plain Diff
Try to unlock recv mutex earlier
parent
2c4eff81
No related branches found
No related tags found
1 merge request
!37
Resolves #83 net performance, partially
Pipeline
#11524
passed
5 years ago
Stage: all
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
components/net/cpp/src/peer.cpp
+5
-9
5 additions, 9 deletions
components/net/cpp/src/peer.cpp
with
5 additions
and
9 deletions
components/net/cpp/src/peer.cpp
+
5
−
9
View file @
28ae652a
...
@@ -417,15 +417,6 @@ void Peer::data() {
...
@@ -417,15 +417,6 @@ void Peer::data() {
bool
Peer
::
_data
()
{
bool
Peer
::
_data
()
{
std
::
unique_lock
<
std
::
recursive_mutex
>
lk
(
recv_mtx_
);
std
::
unique_lock
<
std
::
recursive_mutex
>
lk
(
recv_mtx_
);
/*recv_buf_.reserve_buffer(kMaxMessage);
int rc = ftl::net::internal::recv(sock_, recv_buf_.buffer(), kMaxMessage, 0);
if (rc <= 0) {
return false;
}
recv_buf_.buffer_consumed(rc);*/
if
(
scheme_
==
ftl
::
URI
::
SCHEME_WS
&&
!
ws_read_header_
)
{
if
(
scheme_
==
ftl
::
URI
::
SCHEME_WS
&&
!
ws_read_header_
)
{
wsheader_type
ws
;
wsheader_type
ws
;
if
(
ws_parse
(
recv_buf_
,
ws
)
<
0
)
{
if
(
ws_parse
(
recv_buf_
,
ws
)
<
0
)
{
...
@@ -436,6 +427,8 @@ bool Peer::_data() {
...
@@ -436,6 +427,8 @@ bool Peer::_data() {
msgpack
::
object_handle
msg
;
msgpack
::
object_handle
msg
;
while
(
recv_buf_
.
next
(
msg
))
{
while
(
recv_buf_
.
next
(
msg
))
{
// CHECK Safe to unlock here?
lk
.
unlock
();
ws_read_header_
=
false
;
ws_read_header_
=
false
;
msgpack
::
object
obj
=
msg
.
get
();
msgpack
::
object
obj
=
msg
.
get
();
if
(
status_
!=
kConnected
)
{
if
(
status_
!=
kConnected
)
{
...
@@ -457,6 +450,9 @@ bool Peer::_data() {
...
@@ -457,6 +450,9 @@ bool Peer::_data() {
}
}
disp_
->
dispatch
(
*
this
,
obj
);
disp_
->
dispatch
(
*
this
,
obj
);
// Relock before next loop of while
lk
.
lock
();
if
(
scheme_
==
ftl
::
URI
::
SCHEME_WS
&&
recv_buf_
.
nonparsed_size
()
>
0
)
{
if
(
scheme_
==
ftl
::
URI
::
SCHEME_WS
&&
recv_buf_
.
nonparsed_size
()
>
0
)
{
wsheader_type
ws
;
wsheader_type
ws
;
if
(
ws_parse
(
recv_buf_
,
ws
)
<
0
)
{
if
(
ws_parse
(
recv_buf_
,
ws
)
<
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