From bca0809918a2843b3d5b853a129a3068b0d9882a Mon Sep 17 00:00:00 2001 From: R4SAS Date: Fri, 28 Feb 2020 18:48:43 +0300 Subject: [PATCH] cleanup removed websockets funtions Signed-off-by: R4SAS --- build/CMakeLists.txt | 1 - filelist.mk | 2 +- libi2pd/Event.cpp | 42 --------------------------------- libi2pd/Event.h | 46 ------------------------------------- libi2pd/Tunnel.h | 24 ------------------- libi2pd_client/WebSocks.cpp | 1 - qt/i2pd_qt/i2pd_qt.pro | 2 -- 7 files changed, 1 insertion(+), 117 deletions(-) delete mode 100644 libi2pd/Event.cpp delete mode 100644 libi2pd/Event.h diff --git a/build/CMakeLists.txt b/build/CMakeLists.txt index 324ac468..d39dd113 100644 --- a/build/CMakeLists.txt +++ b/build/CMakeLists.txt @@ -74,7 +74,6 @@ set (LIBI2PD_SRC "${LIBI2PD_SRC_DIR}/Signature.cpp" "${LIBI2PD_SRC_DIR}/Timestamp.cpp" "${LIBI2PD_SRC_DIR}/api.cpp" - "${LIBI2PD_SRC_DIR}/Event.cpp" "${LIBI2PD_SRC_DIR}/Gost.cpp" "${LIBI2PD_SRC_DIR}/ChaCha20.cpp" "${LIBI2PD_SRC_DIR}/Poly1305.cpp" diff --git a/filelist.mk b/filelist.mk index 8d451dc9..72773975 100644 --- a/filelist.mk +++ b/filelist.mk @@ -5,7 +5,7 @@ # SSUSession.cpp SSUData.cpp Streaming.cpp Identity.cpp TransitTunnel.cpp \ # Transports.cpp Tunnel.cpp TunnelEndpoint.cpp TunnelPool.cpp TunnelGateway.cpp \ # Destination.cpp Base.cpp I2PEndian.cpp FS.cpp Config.cpp Family.cpp \ -# Config.cpp HTTP.cpp Timestamp.cpp util.cpp api.cpp Event.cpp Gost.cpp +# Config.cpp HTTP.cpp Timestamp.cpp util.cpp api.cpp Gost.cpp LIB_SRC = $(wildcard $(LIB_SRC_DIR)/*.cpp) diff --git a/libi2pd/Event.cpp b/libi2pd/Event.cpp deleted file mode 100644 index 90c5ed97..00000000 --- a/libi2pd/Event.cpp +++ /dev/null @@ -1,42 +0,0 @@ -#include "Event.h" -#include "Log.h" - -namespace i2p -{ - namespace event - { - void EventCore::SetListener(EventListener * l) - { - m_listener = l; - LogPrint(eLogInfo, "Event: listener set"); - } - - void EventCore::QueueEvent(const EventType & ev) - { - if(m_listener) m_listener->HandleEvent(ev); - } - - void EventCore::CollectEvent(const std::string & type, const std::string & ident, uint64_t val) - { - std::unique_lock lock(m_collect_mutex); - std::string key = type + "." + ident; - if (m_collected.find(key) == m_collected.end()) - { - m_collected[key] = {type, key, 0}; - } - m_collected[key].Val += val; - } - - void EventCore::PumpCollected(EventListener * listener) - { - std::unique_lock lock(m_collect_mutex); - if(listener) - { - for(const auto & ev : m_collected) { - listener->HandlePumpEvent({{"type", ev.second.Key}, {"ident", ev.second.Ident}}, ev.second.Val); - } - } - m_collected.clear(); - } - } -} diff --git a/libi2pd/Event.h b/libi2pd/Event.h deleted file mode 100644 index 74eed1db..00000000 --- a/libi2pd/Event.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef EVENT_H__ -#define EVENT_H__ -#include -#include -#include -#include -#include - -#include - -typedef std::map EventType; - -namespace i2p -{ - namespace event - { - class EventListener { - public: - virtual ~EventListener() {}; - virtual void HandleEvent(const EventType & ev) = 0; - /** @brief handle collected event when pumped */ - virtual void HandlePumpEvent(const EventType & ev, const uint64_t & val) = 0; - }; - - class EventCore - { - public: - void QueueEvent(const EventType & ev); - void CollectEvent(const std::string & type, const std::string & ident, uint64_t val); - void SetListener(EventListener * l); - void PumpCollected(EventListener * l); - - private: - std::mutex m_collect_mutex; - struct CollectedEvent - { - std::string Key; - std::string Ident; - uint64_t Val; - }; - std::map m_collected; - EventListener * m_listener = nullptr; - }; - } -} -#endif diff --git a/libi2pd/Tunnel.h b/libi2pd/Tunnel.h index 66b620b8..f97bcc63 100644 --- a/libi2pd/Tunnel.h +++ b/libi2pd/Tunnel.h @@ -19,35 +19,11 @@ #include "TunnelGateway.h" #include "TunnelBase.h" #include "I2NPProtocol.h" -#include "Event.h" namespace i2p { namespace tunnel { - template - static void EmitTunnelEvent(const std::string & ev, const TunnelT & t) - { - (void) ev; - (void) t; - } - - template - static void EmitTunnelEvent(const std::string & ev, TunnelT * t, const T & val) - { - (void) ev; - (void) t; - (void) val; - } - - template - static void EmitTunnelEvent(const std::string & ev, TunnelT * t, const std::string & val) - { - (void) ev; - (void) t; - (void) val; - } - const int TUNNEL_EXPIRATION_TIMEOUT = 660; // 11 minutes const int TUNNEL_EXPIRATION_THRESHOLD = 60; // 1 minute const int TUNNEL_RECREATION_THRESHOLD = 90; // 1.5 minutes diff --git a/libi2pd_client/WebSocks.cpp b/libi2pd_client/WebSocks.cpp index 95abf455..a3e8c1bf 100644 --- a/libi2pd_client/WebSocks.cpp +++ b/libi2pd_client/WebSocks.cpp @@ -70,4 +70,3 @@ namespace client } } } - diff --git a/qt/i2pd_qt/i2pd_qt.pro b/qt/i2pd_qt/i2pd_qt.pro index 1f01cb4b..ce3ec1ca 100644 --- a/qt/i2pd_qt/i2pd_qt.pro +++ b/qt/i2pd_qt/i2pd_qt.pro @@ -28,7 +28,6 @@ SOURCES += DaemonQT.cpp mainwindow.cpp \ ../../libi2pd/Datagram.cpp \ ../../libi2pd/Destination.cpp \ ../../libi2pd/Ed25519.cpp \ - ../../libi2pd/Event.cpp \ ../../libi2pd/Family.cpp \ ../../libi2pd/FS.cpp \ ../../libi2pd/Garlic.cpp \ @@ -106,7 +105,6 @@ HEADERS += DaemonQT.h mainwindow.h \ ../../libi2pd/Datagram.h \ ../../libi2pd/Destination.h \ ../../libi2pd/Ed25519.h \ - ../../libi2pd/Event.h \ ../../libi2pd/Family.h \ ../../libi2pd/FS.h \ ../../libi2pd/Garlic.h \