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
6cdc242b
Commit
6cdc242b
authored
May 24, 2016
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
node: add pendingMesageCount
parent
ac234640
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/opendht/node.h
+3
-1
3 additions, 1 deletion
include/opendht/node.h
src/dht.cpp
+1
-1
1 addition, 1 deletion
src/dht.cpp
src/node.cpp
+14
-1
14 additions, 1 deletion
src/node.cpp
with
18 additions
and
3 deletions
include/opendht/node.h
+
3
−
1
View file @
6cdc242b
...
@@ -57,7 +57,9 @@ struct Node {
...
@@ -57,7 +57,9 @@ struct Node {
}
}
bool
isExpired
()
const
{
return
expired_
;
}
bool
isExpired
()
const
{
return
expired_
;
}
bool
isGood
(
time_point
now
)
const
;
bool
isGood
(
time_point
now
)
const
;
bool
isMessagePending
()
const
;
bool
isPendingMessage
()
const
;
size_t
getPendingMessageCount
()
const
;
NodeExport
exportNode
()
const
{
return
NodeExport
{
id
,
ss
,
sslen
};
}
NodeExport
exportNode
()
const
{
return
NodeExport
{
id
,
ss
,
sslen
};
}
sa_family_t
getFamily
()
const
{
return
ss
.
ss_family
;
}
sa_family_t
getFamily
()
const
{
return
ss
.
ss_family
;
}
...
...
This diff is collapsed.
Click to expand it.
src/dht.cpp
+
1
−
1
View file @
6cdc242b
...
@@ -503,7 +503,7 @@ Dht::newNode(const std::shared_ptr<Node>& node, int confirm)
...
@@ -503,7 +503,7 @@ Dht::newNode(const std::shared_ptr<Node>& node, int confirm)
of bad nodes fast. */
of bad nodes fast. */
if
(
not
n
->
isGood
(
now
))
{
if
(
not
n
->
isGood
(
now
))
{
dubious
=
true
;
dubious
=
true
;
if
(
not
n
->
is
Message
Pending
())
{
if
(
not
n
->
isPending
Message
())
{
DHT_LOG
.
DEBUG
(
"Sending ping to dubious node %s."
,
n
->
toString
().
c_str
());
DHT_LOG
.
DEBUG
(
"Sending ping to dubious node %s."
,
n
->
toString
().
c_str
());
network_engine
.
sendPing
(
n
,
nullptr
,
nullptr
);
network_engine
.
sendPing
(
n
,
nullptr
,
nullptr
);
break
;
break
;
...
...
This diff is collapsed.
Click to expand it.
src/node.cpp
+
14
−
1
View file @
6cdc242b
...
@@ -40,7 +40,7 @@ Node::isGood(time_point now) const
...
@@ -40,7 +40,7 @@ Node::isGood(time_point now) const
}
}
bool
bool
Node
::
is
Message
Pending
()
const
Node
::
isPending
Message
()
const
{
{
for
(
auto
w
:
requests_
)
{
for
(
auto
w
:
requests_
)
{
if
(
auto
r
=
w
.
lock
())
{
if
(
auto
r
=
w
.
lock
())
{
...
@@ -51,6 +51,19 @@ Node::isMessagePending() const
...
@@ -51,6 +51,19 @@ Node::isMessagePending() const
return
false
;
return
false
;
}
}
size_t
Node
::
getPendingMessageCount
()
const
{
size_t
count
{
0
};
for
(
auto
w
:
requests_
)
{
if
(
auto
r
=
w
.
lock
())
{
if
(
r
->
pending
())
count
++
;
}
}
return
count
;
}
void
void
Node
::
update
(
const
sockaddr
*
sa
,
socklen_t
salen
)
Node
::
update
(
const
sockaddr
*
sa
,
socklen_t
salen
)
{
{
...
...
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