get port from tox
This commit is contained in:
@@ -13,5 +13,6 @@ target_include_directories(solanaceae_tox_upnp PUBLIC .)
|
||||
target_compile_features(solanaceae_tox_upnp PUBLIC cxx_std_17)
|
||||
target_link_libraries(solanaceae_tox_upnp PUBLIC
|
||||
miniupnpc::miniupnpc
|
||||
solanaceae_toxcore_interface
|
||||
)
|
||||
|
||||
|
@@ -8,8 +8,13 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
ToxUPnP::ToxUPnP(void) {
|
||||
ToxUPnP::ToxUPnP(ToxI& tox) {
|
||||
// get tox port
|
||||
auto [port_opt, _] = tox.toxSelfGetUDPPort();
|
||||
if (!port_opt.has_value()) {
|
||||
return; // oof
|
||||
}
|
||||
_local_port = port_opt.value();
|
||||
|
||||
// start upnp thread
|
||||
_thread = std::thread([this](void) {
|
||||
|
@@ -4,16 +4,16 @@
|
||||
#include <atomic>
|
||||
#include <thread>
|
||||
|
||||
class ToxUPnP {
|
||||
// TODO: ToxI& _t;
|
||||
#include <solanaceae/toxcore/tox_interface.hpp>
|
||||
|
||||
class ToxUPnP {
|
||||
uint16_t _local_port {33445};
|
||||
|
||||
std::atomic_bool _quit {false};
|
||||
std::thread _thread;
|
||||
|
||||
public:
|
||||
ToxUPnP(void);
|
||||
ToxUPnP(ToxI& tox);
|
||||
~ToxUPnP(void);
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user