From 975b4ca743877bcf7dd67cf0c86ebc728807e644 Mon Sep 17 00:00:00 2001 From: Rick V Date: Tue, 26 Feb 2019 15:40:12 -0600 Subject: [PATCH] clang-format --- llarp/ev/ev_win32.cpp | 1 - llarp/path/path.cpp | 47 +++++++++---------- llarp/service/endpoint.cpp | 13 +++--- llarp/util/threadpool.h | 4 +- vendor/libtuntap-master/tuntap-windows.c | 9 ++-- win32-setup/regdb_helper.c | 59 +++++++++++++----------- 6 files changed, 68 insertions(+), 65 deletions(-) diff --git a/llarp/ev/ev_win32.cpp b/llarp/ev/ev_win32.cpp index 49fca04e8..34e85bd07 100644 --- a/llarp/ev/ev_win32.cpp +++ b/llarp/ev/ev_win32.cpp @@ -62,7 +62,6 @@ win32_tun_io::setup() // This *probably* has the effect of making packets move in order now // as only one IOCP thread will have access to the TUN handler at a // time - // XXX: network isn't in a state where this bug can be tested! InitializeCriticalSection(&HandlerMtx); return true; diff --git a/llarp/path/path.cpp b/llarp/path/path.cpp index b68d2ff14..7717bedfe 100644 --- a/llarp/path/path.cpp +++ b/llarp/path/path.cpp @@ -160,26 +160,24 @@ namespace llarp IHopHandler* PathContext::GetByUpstream(const RouterID& remote, const PathID_t& id) { - auto own = MapGet( - m_OurPaths, id, - [](__attribute__((unused)) const PathSet* s) -> bool { - // TODO: is this right? - return true; - }, - [remote, id](PathSet* p) -> IHopHandler* { - return p->GetByUpstream(remote, id); - }); + auto own = MapGet(m_OurPaths, id, + [](__attribute__((unused)) const PathSet* s) -> bool { + // TODO: is this right? + return true; + }, + [remote, id](PathSet* p) -> IHopHandler* { + return p->GetByUpstream(remote, id); + }); if(own) return own; - return MapGet( - m_TransitPaths, id, - [remote](const std::shared_ptr< TransitHop >& hop) -> bool { - return hop->info.upstream == remote; - }, - [](const std::shared_ptr< TransitHop >& h) -> IHopHandler* { - return h.get(); - }); + return MapGet(m_TransitPaths, id, + [remote](const std::shared_ptr< TransitHop >& hop) -> bool { + return hop->info.upstream == remote; + }, + [](const std::shared_ptr< TransitHop >& h) -> IHopHandler* { + return h.get(); + }); } bool @@ -196,14 +194,13 @@ namespace llarp IHopHandler* PathContext::GetByDownstream(const RouterID& remote, const PathID_t& id) { - return MapGet( - m_TransitPaths, id, - [remote](const std::shared_ptr< TransitHop >& hop) -> bool { - return hop->info.downstream == remote; - }, - [](const std::shared_ptr< TransitHop >& h) -> IHopHandler* { - return h.get(); - }); + return MapGet(m_TransitPaths, id, + [remote](const std::shared_ptr< TransitHop >& hop) -> bool { + return hop->info.downstream == remote; + }, + [](const std::shared_ptr< TransitHop >& h) -> IHopHandler* { + return h.get(); + }); } PathSet* diff --git a/llarp/service/endpoint.cpp b/llarp/service/endpoint.cpp index 5b2d9fe0b..17c78bc95 100644 --- a/llarp/service/endpoint.cpp +++ b/llarp/service/endpoint.cpp @@ -1326,13 +1326,12 @@ namespace llarp } } // no converstation - return EnsurePathToService( - remote, - [](Address, OutboundContext* c) { - if(c) - c->UpdateIntroSet(true); - }, - 5000, false); + return EnsurePathToService(remote, + [](Address, OutboundContext* c) { + if(c) + c->UpdateIntroSet(true); + }, + 5000, false); } bool diff --git a/llarp/util/threadpool.h b/llarp/util/threadpool.h index c7a068bbc..5adaff876 100644 --- a/llarp/util/threadpool.h +++ b/llarp/util/threadpool.h @@ -16,8 +16,8 @@ struct llarp_threadpool std::queue< std::function< void(void) > > jobs; llarp_threadpool(int workers, const char *name) - : impl( - std::make_unique< llarp::thread::ThreadPool >(workers, workers * 128)) + : impl(std::make_unique< llarp::thread::ThreadPool >(workers, + workers * 128)) { (void)name; } diff --git a/vendor/libtuntap-master/tuntap-windows.c b/vendor/libtuntap-master/tuntap-windows.c index f64d0751b..9a313ea2c 100644 --- a/vendor/libtuntap-master/tuntap-windows.c +++ b/vendor/libtuntap-master/tuntap-windows.c @@ -326,7 +326,8 @@ tuntap_get_mtu(struct device *dev) return 0; } -/* I _think_ it's possible to do this on windows, might be a setting in the reg db */ +/* I _think_ it's possible to do this on windows, might be a setting in the reg + * db */ int tuntap_set_mtu(struct device *dev, int mtu) { @@ -404,7 +405,8 @@ tuntap_sys_set_ipv4(struct device *dev, t_tun_in_addr *s, uint32_t mask) return 0; } -/* To be implemented at a later time? I'm not quite certain TAP-Windows v9.x supports inet6 */ +/* To be implemented at a later time? I'm not quite certain TAP-Windows v9.x + * supports inet6 */ int tuntap_sys_set_ipv6(struct device *dev, t_tun_in6_addr *s, uint32_t mask) { @@ -416,7 +418,8 @@ tuntap_sys_set_ipv6(struct device *dev, t_tun_in6_addr *s, uint32_t mask) return -1; } -/* Anything below this comment is unimplemented, either due to lack of OS support, or duplicated functionality elsewhere */ +/* Anything below this comment is unimplemented, either due to lack of OS + * support, or duplicated functionality elsewhere */ int tuntap_read(struct device *dev, void *buf, size_t size) { diff --git a/win32-setup/regdb_helper.c b/win32-setup/regdb_helper.c index 5c288a11f..4b1ba32a0 100644 --- a/win32-setup/regdb_helper.c +++ b/win32-setup/regdb_helper.c @@ -1,26 +1,26 @@ /* -* Copyright (c)2018-2019 Rick V. All rights reserved. -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*------------------------------------------------------------------------------ -* Shared object loaded by lokinet installer to properly detect the presence -* of the TAP v9 adapter -* -rick -*/ + * Copyright (c)2018-2019 Rick V. All rights reserved. + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + *------------------------------------------------------------------------------ + * Shared object loaded by lokinet installer to properly detect the presence + * of the TAP v9 adapter + * -rick + */ #include #include @@ -41,10 +41,12 @@ reg_query_helper() DWORD i, ret, len; char *deviceid = NULL; DWORD sub_keys = 0; - BOOL found = FALSE; + BOOL found = FALSE; - ret = - RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}"), 0, KEY_READ, &adapters); + ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, + TEXT("SYSTEM\\CurrentControlSet\\Control\\Class\\{" + "4D36E972-E325-11CE-BFC1-08002BE10318}"), + 0, KEY_READ, &adapters); if(ret != ERROR_SUCCESS) return FALSE; @@ -70,7 +72,10 @@ reg_query_helper() continue; /* Append it to NETWORK_ADAPTERS and open it */ - snprintf(new_key, sizeof new_key, "%s\\%s", "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}", key); + snprintf(new_key, sizeof new_key, "%s\\%s", + "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-" + "BFC1-08002BE10318}", + key); ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT(new_key), 0, KEY_READ, &adapter); if(ret != ERROR_SUCCESS) @@ -86,7 +91,7 @@ reg_query_helper() goto clean; } /* If its a tap adapter, its all good */ - /* We only support TAP 9.x, TAP 8.x users must upgrade. */ + /* We only support TAP 9.x, TAP 8.x users must upgrade. */ if(strncmp(data, "tap0901", 7) == 0) { DWORD type;