Skip to content

Commit 30868b5

Browse files
committed
fixed static build, dropped unnecessary latest libevent external, other misc
1 parent 4d9d97d commit 30868b5

19 files changed

+80
-115
lines changed

.drone.jsonnet

+5-3
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ local docs_pipeline(name, image, extra_cmds=[], allow_fail=false) = {
384384
'echo "Building on ${DRONE_STAGE_MACHINE}"',
385385
apt_get_quiet + ' update',
386386
apt_get_quiet + ' install -y eatmydata',
387-
'eatmydata ' + apt_get_quiet + ' install --no-install-recommends -y git clang-format-15 jsonnet',
387+
'eatmydata ' + apt_get_quiet + ' install --no-install-recommends -y git clang-format-16 jsonnet',
388388
'./contrib/ci/drone-format-verify.sh',
389389
],
390390
}],
@@ -397,8 +397,10 @@ local docs_pipeline(name, image, extra_cmds=[], allow_fail=false) = {
397397
// Various debian builds
398398
debian_pipeline('Debian sid (amd64)', docker_base + 'debian-sid'),
399399
debian_pipeline('Debian sid/Debug (amd64)', docker_base + 'debian-sid', build_type='Debug'),
400-
clang(16),
401-
full_llvm(16),
400+
clang(17),
401+
full_llvm(17),
402+
clang(19),
403+
full_llvm(19),
402404
debian_pipeline('Debian stable (i386)', docker_base + 'debian-stable/i386'),
403405
debian_pipeline('Debian bullseye (amd64)',
404406
docker_base + 'debian-bullseye',

.gitmodules

-3
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,3 @@
2929
[submodule "external/oxen-encoding"]
3030
path = external/oxen-encoding
3131
url = https://github.com/oxen-io/oxen-encoding.git
32-
[submodule "external/libevent"]
33-
path = external/libevent
34-
url = https://github.com/libevent/libevent.git

CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,10 @@ target_include_directories(lokinet-base-internal INTERFACE include/lokinet)
271271

272272
target_link_libraries(lokinet-base-internal INTERFACE lokinet-base-internal_warnings)
273273

274+
if (TARGET lokinet_static_deps)
275+
target_link_libraries(lokinet-base-internal INTERFACE lokinet_static_deps)
276+
endif()
277+
274278
if(WITH_SYSTEMD AND (NOT ANDROID))
275279
if(NOT SD_FOUND)
276280
message(FATAL_ERROR "libsystemd not found")

cmake/StaticBuild.cmake

+11-9
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ set(ZMQ_SOURCE zeromq-${ZMQ_VERSION}.tar.gz)
4848
set(ZMQ_HASH SHA512=a71d48aa977ad8941c1609947d8db2679fc7a951e4cd0c3a1127ae026d883c11bd4203cf315de87f95f5031aec459a731aec34e5ce5b667b8d0559b157952541
4949
CACHE STRING "libzmq source hash")
5050

51-
set(ZLIB_VERSION 1.3 CACHE STRING "zlib version")
51+
set(ZLIB_VERSION 1.3.1 CACHE STRING "zlib version")
5252
set(ZLIB_MIRROR ${LOCAL_MIRROR} https://zlib.net
5353
CACHE STRING "zlib mirror(s)")
5454
set(ZLIB_SOURCE zlib-${ZLIB_VERSION}.tar.xz)
55-
set(ZLIB_HASH SHA256=8a9ba2898e1d0d774eca6ba5b4627a11e5588ba85c8851336eb38de4683050a7
55+
set(ZLIB_HASH SHA256=38ef96b8dfe510d42707d9c781877914792541133e1870841463bfa73f883e32
5656
CACHE STRING "zlib source hash")
5757

5858
set(CURL_VERSION 7.86.0 CACHE STRING "curl version")
@@ -89,16 +89,22 @@ function(expand_urls output source_file)
8989
set(${output} "${expanded}" PARENT_SCOPE)
9090
endfunction()
9191

92+
93+
add_library(lokinet_static_deps INTERFACE)
94+
9295
function(add_static_target target ext_target libname)
9396
add_library(${target} STATIC IMPORTED GLOBAL)
9497
add_dependencies(${target} ${ext_target})
98+
target_link_libraries(lokinet_static_deps INTERFACE ${target})
9599
set_target_properties(${target} PROPERTIES
96100
IMPORTED_LOCATION ${DEPS_DESTDIR}/lib/${libname}
97101
)
102+
if (ARGN)
103+
target_link_libraries(${target} INTERFACE ${ARGN})
104+
endif()
98105
endfunction()
99106

100107

101-
102108
set(cross_host "")
103109
set(cross_rc "")
104110
if(CMAKE_CROSSCOMPILING)
@@ -357,13 +363,9 @@ set_target_properties(libzmq PROPERTIES
357363

358364

359365
#
366+
# Everything that follows is *only* for lokinet-bootstrap (i.e. if adding new deps put them *above* this).
360367
#
361-
#
362-
# Everything that follows is *only* for lokinet-bootstrap (i.e. if adding new deps put them *above*
363-
# this).
364-
#
365-
#
366-
#
368+
367369
if(NOT WITH_BOOTSTRAP)
368370
return()
369371
endif()

daemon/utils.cpp

-33
Original file line numberDiff line numberDiff line change
@@ -110,39 +110,6 @@ namespace llarp::controller
110110
logcat, "Could not find connection ID to RPC bind {} for `session_close` command", src.full_address());
111111
}
112112

113-
// bool rpc_controller::_initial_info_request()
114-
// {
115-
// int i = 0;
116-
// std::vector<std::promise<bool>> proms{_binds.size()};
117-
118-
// for (auto& [b, instance] : _binds)
119-
// {
120-
// _omq->request(instance.cid, "llarp.status", [&, idx = i](bool success, std::vector<std::string> data) {
121-
// if (success)
122-
// {
123-
// auto res = nlohmann::json::parse(data[0]);
124-
// instance.rid = res["instance"]["id"].template get<std::string_view>();
125-
// log::info(logcat, "rid = {}", instance.rid);
126-
// proms[idx].set_value(true);
127-
// }
128-
// else
129-
// {
130-
// log::critical(logcat, "RPC call to query initial router status failed!");
131-
// proms[idx].set_value(false);
132-
// }
133-
// });
134-
135-
// i += 1;
136-
// }
137-
138-
// bool ret = true;
139-
140-
// for (auto& p : proms)
141-
// ret &= p.get_future().get();
142-
143-
// return ret;
144-
// }
145-
146113
bool rpc_controller::_omq_connect(const std::vector<std::string>& bind_addrs)
147114
{
148115
int i = 0;

daemon/utils.hpp

-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ namespace llarp::controller
1919

2020
private:
2121
static size_t next_id;
22-
// RouterID rid;
2322

2423
public:
2524
lokinet_instance(omq::ConnectionID c) : ID{++next_id}, cid{std::move(c)} {}
@@ -46,8 +45,6 @@ namespace llarp::controller
4645
void _status(omq::address src);
4746
void _close(omq::address src, std::string remote);
4847

49-
// bool _initial_info_request();
50-
5148
bool _omq_connect(const std::vector<std::string>& bind_addrs);
5249

5350
public:

external/CMakeLists.txt

+3-20
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ if(SUBMODULE_CHECK)
2626
message(STATUS "Checking submodules")
2727
check_submodule(CLI11)
2828
check_submodule(cpr)
29-
check_submodule(libevent)
3029
check_submodule(nlohmann)
3130
check_submodule(oxen-encoding)
3231
check_submodule(oxen-libquic)
@@ -51,28 +50,13 @@ macro(system_or_submodule BIGNAME smallname pkgconf subdir)
5150
message(STATUS "Found system ${smallname} ${${BIGNAME}_VERSION}")
5251
else()
5352
message(STATUS "using ${smallname} submodule")
54-
add_subdirectory(${subdir})
53+
add_subdirectory(${subdir} EXCLUDE_FROM_ALL)
5554
endif()
5655
if(NOT TARGET ${smallname}::${smallname})
5756
add_library(${smallname}::${smallname} ALIAS ${smallname})
5857
endif()
5958
endmacro()
6059

61-
# libevent
62-
set(EVENT__LIBRARY_TYPE "STATIC" CACHE STRING "" FORCE)
63-
set(EVENT__DISABLE_MBEDTLS ON CACHE BOOL "" FORCE)
64-
set(EVENT__DISABLE_MBEDTLS ON CACHE BOOL "" FORCE)
65-
set(EVENT__DISABLE_OPENSSL ON CACHE BOOL "" FORCE)
66-
set(EVENT__DISABLE_BENCHMARK ON CACHE BOOL "" FORCE)
67-
set(EVENT__DISABLE_SAMPLES ON CACHE BOOL "" FORCE)
68-
set(EVENT__DISABLE_TESTS ON CACHE BOOL "" FORCE)
69-
add_subdirectory(libevent EXCLUDE_FROM_ALL)
70-
71-
add_library(libevent::core ALIAS event_core)
72-
add_library(libevent::threads ALIAS event_pthreads)
73-
add_library(libevent::extra ALIAS event_extra)
74-
75-
7660
system_or_submodule(OXENC oxenc liboxenc>=1.1.0 oxen-encoding)
7761
system_or_submodule(OXENMQ oxenmq liboxenmq>=1.2.14 oxen-mq)
7862

@@ -102,9 +86,8 @@ if(WITH_PEERSTATS)
10286
endif()
10387

10488

105-
# we get oxen-logging from libquic; forcing submodule ensures fmt>10.0.0
106-
set(OXEN_LOGGING_FORCE_SUBMODULES ON CACHE INTERNAL "")
107-
add_subdirectory(oxen-libquic)
89+
set(LIBQUIC_BUILD_TESTS OFF CACHE BOOL "")
90+
system_or_submodule(OXENQUIC quic liboxenquic>=1.2.0 oxen-libquic)
10891

10992

11093
# cpr configuration. Ideally we'd just do this via add_subdirectory, but cpr's cmake requires

external/libevent

-1
This file was deleted.

llarp/CMakeLists.txt

-4
Original file line numberDiff line numberDiff line change
@@ -262,10 +262,6 @@ target_link_libraries(lokinet-core
262262

263263
target_link_libraries(lokinet-base
264264
INTERFACE
265-
266-
libevent::core
267-
libevent::threads
268-
libevent::extra
269265

270266
Threads::Threads
271267

llarp/config/config.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ namespace llarp
522522
ReachableDefault,
523523
assignment_acceptor(is_reachable),
524524
Comment{
525-
"Determines whether we will pubish our service's ClientContact to the DHT (client default: TRUE)",
525+
"Determines whether we will pubish our service's ClientContact to the network (client default: TRUE)",
526526
});
527527

528528
conf.define_option<int>(

llarp/contact/contactdb.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ namespace llarp
4444

4545
void ContactDB::purge_ccs(std::chrono::milliseconds now)
4646
{
47-
log::debug(logcat, "{} called", __PRETTY_FUNCTION__);
47+
log::trace(logcat, "{} called", __PRETTY_FUNCTION__);
48+
assert(_router.loop()->in_event_loop());
4849

4950
if (_router.is_stopping() || not _router.is_running())
5051
{

llarp/ev/types.hpp

-5
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22

33
#include <oxen/quic.hpp>
44

5-
extern "C"
6-
{
7-
#include <event2/watch.h>
8-
}
9-
105
namespace llarp
116
{
127
using namespace std::chrono_literals;

llarp/handlers/session.cpp

+23-9
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,14 @@ namespace llarp::handlers
8888

8989
if (_cc_publisher)
9090
{
91-
log::trace(logcat, "ClientContact publish ticker stopped!");
9291
_cc_publisher->stop();
92+
log::trace(logcat, "ClientContact publish ticker stopped!");
93+
}
94+
95+
if (_path_rotater)
96+
{
97+
_path_rotater->stop();
98+
log::trace(logcat, "Path rotation ticker stopped!");
9399
}
94100

95101
if (send_close)
@@ -272,6 +278,10 @@ namespace llarp::handlers
272278
},
273279
true);
274280
});
281+
282+
log::trace(logcat, "Starting path rotation ticker...");
283+
_path_rotater =
284+
_router.loop()->call_every(path::PATH_ROTATION_INTERVAL, [this]() mutable { rotate_paths(); });
275285
}
276286
else
277287
log::info(logcat, "SessionEndpoint configured to NOT publish ClientContact...");
@@ -473,20 +483,24 @@ namespace llarp::handlers
473483
_router.loop()->call([this]() mutable {
474484
log::warning(
475485
logcat,
476-
"Failed to query enough client introductions from current paths! Building more paths to publish "
477-
"introset");
486+
"Failed to query enough client intros from current paths! Building more paths to publish contact!");
478487
return build_more(1);
479488
});
480489
}
481490

482491
void SessionEndpoint::update_and_publish_localcc()
483492
{
484-
log::debug(logcat, "Updating and publishing ClientContact...");
485-
auto intros = get_current_client_intros();
486-
if (intros.empty())
487-
return _localcc_update_fail();
488-
client_contact.regenerate(std::move(intros));
489-
_update_and_publish_localcc();
493+
if (should_publish_cc)
494+
{
495+
log::debug(logcat, "Updating and publishing ClientContact...");
496+
auto intros = get_current_client_intros();
497+
if (intros.empty())
498+
return _localcc_update_fail();
499+
client_contact.regenerate(std::move(intros));
500+
_update_and_publish_localcc();
501+
}
502+
else
503+
log::warning(logcat, "Local instance not configured to publish ClientContact!");
490504
}
491505

492506
void SessionEndpoint::_update_and_publish_localcc()

0 commit comments

Comments
 (0)