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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
opendht
Commits
f0b9bc56
Commit
f0b9bc56
authored
3 years ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
c: add dht_runner_is_running, dht_runner_get_bound_port
parent
5654816f
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
c/opendht.cpp
+11
-0
11 additions, 0 deletions
c/opendht.cpp
c/opendht_c.h
+3
-0
3 additions, 0 deletions
c/opendht_c.h
with
14 additions
and
0 deletions
c/opendht.cpp
+
11
−
0
View file @
f0b9bc56
...
...
@@ -413,6 +413,17 @@ void dht_runner_shutdown(dht_runner* r, dht_shutdown_cb done_cb, void* cb_user_d
});
}
bool
dht_runner_is_running
(
const
dht_runner
*
r
)
{
if
(
not
r
)
return
false
;
auto
runner
=
reinterpret_cast
<
const
dht
::
DhtRunner
*>
(
r
);
return
runner
->
isRunning
();
}
in_port_t
dht_runner_get_bound_port
(
const
dht_runner
*
r
,
sa_family_t
af
)
{
auto
runner
=
reinterpret_cast
<
const
dht
::
DhtRunner
*>
(
r
);
return
runner
->
getBoundPort
(
af
);
}
dht_infohash
dht_runner_get_node_id
(
const
dht_runner
*
r
)
{
auto
runner
=
reinterpret_cast
<
const
dht
::
DhtRunner
*>
(
r
);
dht_infohash
ret
;
...
...
This diff is collapsed.
Click to expand it.
c/opendht_c.h
+
3
−
0
View file @
f0b9bc56
...
...
@@ -153,6 +153,9 @@ OPENDHT_C_PUBLIC void dht_runner_cancel_put(dht_runner* runner, const dht_infoha
OPENDHT_C_PUBLIC
void
dht_runner_shutdown
(
dht_runner
*
runner
,
dht_shutdown_cb
done_cb
,
void
*
cb_user_data
);
OPENDHT_C_PUBLIC
dht_infohash
dht_runner_get_node_id
(
const
dht_runner
*
runner
);
OPENDHT_C_PUBLIC
dht_infohash
dht_runner_get_id
(
const
dht_runner
*
runner
);
OPENDHT_C_PUBLIC
bool
dht_runner_is_running
(
const
dht_runner
*
runner
);
OPENDHT_C_PUBLIC
in_port_t
dht_runner_get_bound_port
(
const
dht_runner
*
runner
,
sa_family_t
af
);
/** Returns null-terminated array that must be freed after use as well as each element */
OPENDHT_C_PUBLIC
struct
sockaddr
**
dht_runner_get_public_address
(
const
dht_runner
*
runner
);
#ifdef __cplusplus
...
...
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