Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
opendht
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
opendht
Commits
39e69f81
Commit
39e69f81
authored
6 years ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
network engine: cleanup
parent
8045c2cb
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/network_engine.cpp
+10
-11
10 additions, 11 deletions
src/network_engine.cpp
with
10 additions
and
11 deletions
src/network_engine.cpp
+
10
−
11
View file @
39e69f81
...
...
@@ -353,9 +353,8 @@ NetworkEngine::rateLimit(const SockAddr& addr)
limiter_maintenance
=
0
;
}
auto
it
=
address_rate_limiter
.
emplace
(
addr
,
IpLimiter
{});
// invoke per IP, then global rate limiter
return
it
.
first
->
second
.
limit
(
now
)
and
rate_limiter
.
limit
(
now
);
return
address_rate_limiter
[
addr
]
.
limit
(
now
)
and
rate_limiter
.
limit
(
now
);
}
bool
...
...
@@ -475,15 +474,15 @@ NetworkEngine::processMessage(const uint8_t *buf, size_t buflen, const SockAddr&
process
(
std
::
move
(
msg
),
from
);
}
else
{
// starting partial message session
PartialMessage
pmsg
;
auto
k
=
msg
->
tid
;
auto
&
pmsg
=
partial_messages
[
k
];
if
(
not
pmsg
.
msg
)
{
pmsg
.
from
=
from
;
pmsg
.
msg
=
std
::
move
(
msg
);
pmsg
.
start
=
now
;
pmsg
.
last_part
=
now
;
auto
wmsg
=
partial_messages
.
emplace
(
pmsg
.
msg
->
tid
,
std
::
move
(
pmsg
));
if
(
wmsg
.
second
)
{
scheduler
.
add
(
now
+
RX_MAX_PACKET_TIME
,
std
::
bind
(
&
NetworkEngine
::
maintainRxBuffer
,
this
,
wmsg
.
first
->
first
));
scheduler
.
add
(
now
+
RX_TIMEOUT
,
std
::
bind
(
&
NetworkEngine
::
maintainRxBuffer
,
this
,
wmsg
.
first
->
first
));
scheduler
.
add
(
now
+
RX_MAX_PACKET_TIME
,
std
::
bind
(
&
NetworkEngine
::
maintainRxBuffer
,
this
,
k
));
scheduler
.
add
(
now
+
RX_TIMEOUT
,
std
::
bind
(
&
NetworkEngine
::
maintainRxBuffer
,
this
,
k
));
}
else
DHT_LOG
.
e
(
"Partial message with given TID already exists"
);
}
...
...
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