mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-03-22 00:59:08 +01:00
merge
This commit is contained in:
parent
cd9cd84c5b
commit
d4a0076aba
13 changed files with 232 additions and 234 deletions
|
@ -314,7 +314,9 @@ namespace i2p
|
||||||
|
|
||||||
bool Daemon_Singleton::stop()
|
bool Daemon_Singleton::stop()
|
||||||
{
|
{
|
||||||
|
#ifdef WITH_EVENTS
|
||||||
i2p::event::core.SetListener(nullptr);
|
i2p::event::core.SetListener(nullptr);
|
||||||
|
#endif
|
||||||
LogPrint(eLogInfo, "Daemon: shutting down");
|
LogPrint(eLogInfo, "Daemon: shutting down");
|
||||||
LogPrint(eLogInfo, "Daemon: stopping Client");
|
LogPrint(eLogInfo, "Daemon: stopping Client");
|
||||||
i2p::client::context.Stop();
|
i2p::client::context.Stop();
|
||||||
|
@ -352,5 +354,5 @@ namespace i2p
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,8 @@ namespace i2p
|
||||||
|
|
||||||
void EmitEvent(const EventType & e)
|
void EmitEvent(const EventType & e)
|
||||||
{
|
{
|
||||||
|
#ifdef WITH_EVENTS
|
||||||
i2p::event::core.QueueEvent(e);
|
i2p::event::core.QueueEvent(e);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
Makefile
2
Makefile
|
@ -15,7 +15,7 @@ USE_MESHNET := no
|
||||||
USE_UPNP := no
|
USE_UPNP := no
|
||||||
|
|
||||||
|
|
||||||
ifeq ($(WEBSOCKET),1)
|
ifeq ($(WEBSOCKETS),1)
|
||||||
NEEDED_CXXFLAGS += -DWITH_EVENTS
|
NEEDED_CXXFLAGS += -DWITH_EVENTS
|
||||||
DAEMON_SRC += Websocket.cpp
|
DAEMON_SRC += Websocket.cpp
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -234,7 +234,7 @@ namespace transport
|
||||||
if (!m_ReceivedMessages.count (msgID))
|
if (!m_ReceivedMessages.count (msgID))
|
||||||
{
|
{
|
||||||
m_ReceivedMessages.insert (msgID);
|
m_ReceivedMessages.insert (msgID);
|
||||||
m_LastMessageReceivedTime = i2p::util::GetSinceEpoch<Time> ();
|
m_LastMessageReceivedTime = i2p::util::GetSecondsSinceEpoch ();
|
||||||
if (!msg->IsExpired ()) {
|
if (!msg->IsExpired ()) {
|
||||||
EmitEvent({{"type", "transport.recvmsg"} , {"ident", m_Session.GetIdentHashBase64()}, {"number", "1"}});
|
EmitEvent({{"type", "transport.recvmsg"} , {"ident", m_Session.GetIdentHashBase64()}, {"number", "1"}});
|
||||||
m_Handler.PutNextMessage (msg);
|
m_Handler.PutNextMessage (msg);
|
||||||
|
|
|
@ -231,7 +231,6 @@ namespace transport
|
||||||
|
|
||||||
void Transports::SendMessages (const i2p::data::IdentHash& ident, const std::vector<std::shared_ptr<i2p::I2NPMessage> >& msgs)
|
void Transports::SendMessages (const i2p::data::IdentHash& ident, const std::vector<std::shared_ptr<i2p::I2NPMessage> >& msgs)
|
||||||
{
|
{
|
||||||
|
|
||||||
EmitEvent({{"type" , "transport.sendmsg"}, {"ident", ident.ToBase64()}, {"number", std::to_string(msgs.size())}});
|
EmitEvent({{"type" , "transport.sendmsg"}, {"ident", ident.ToBase64()}, {"number", std::to_string(msgs.size())}});
|
||||||
m_Service.post (std::bind (&Transports::PostMessages, this, ident, msgs));
|
m_Service.post (std::bind (&Transports::PostMessages, this, ident, msgs));
|
||||||
}
|
}
|
||||||
|
@ -510,7 +509,6 @@ namespace transport
|
||||||
bool nat; i2p::config::GetOption("nat", nat);
|
bool nat; i2p::config::GetOption("nat", nat);
|
||||||
if (nat)
|
if (nat)
|
||||||
i2p::context.SetStatus (eRouterStatusTesting);
|
i2p::context.SetStatus (eRouterStatusTesting);
|
||||||
|
|
||||||
for (int i = 0; i < 5; i++)
|
for (int i = 0; i < 5; i++)
|
||||||
{
|
{
|
||||||
auto router = i2p::data::netdb.GetRandomPeerTestRouter ();
|
auto router = i2p::data::netdb.GetRandomPeerTestRouter ();
|
||||||
|
@ -573,7 +571,6 @@ namespace transport
|
||||||
if (it != m_Peers.end ())
|
if (it != m_Peers.end ())
|
||||||
{
|
{
|
||||||
EmitEvent({{"type" , "transport.connected"}, {"ident", ident.ToBase64()}, {"inbound", "false"}});
|
EmitEvent({{"type" , "transport.connected"}, {"ident", ident.ToBase64()}, {"inbound", "false"}});
|
||||||
|
|
||||||
bool sendDatabaseStore = true;
|
bool sendDatabaseStore = true;
|
||||||
if (it->second.delayedMessages.size () > 0)
|
if (it->second.delayedMessages.size () > 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include "Transports.h"
|
#include "Transports.h"
|
||||||
#include "NetDb.h"
|
#include "NetDb.h"
|
||||||
#include "Tunnel.h"
|
#include "Tunnel.h"
|
||||||
|
#include "TunnelPool.h"
|
||||||
|
|
||||||
namespace i2p
|
namespace i2p
|
||||||
{
|
{
|
||||||
|
@ -65,7 +66,6 @@ namespace tunnel
|
||||||
#ifdef WITH_EVENTS
|
#ifdef WITH_EVENTS
|
||||||
EmitTunnelEvent("tunnel.build", this, peers);
|
EmitTunnelEvent("tunnel.build", this, peers);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// fill up fake records with random data
|
// fill up fake records with random data
|
||||||
for (int i = numHops; i < numRecords; i++)
|
for (int i = numHops; i < numRecords; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include "Garlic.h"
|
#include "Garlic.h"
|
||||||
#include "Transports.h"
|
#include "Transports.h"
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
|
#include "Tunnel.h"
|
||||||
#include "TunnelPool.h"
|
#include "TunnelPool.h"
|
||||||
#include "Destination.h"
|
#include "Destination.h"
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
|
@ -83,7 +84,6 @@ namespace tunnel
|
||||||
if (expiredTunnel)
|
if (expiredTunnel)
|
||||||
{
|
{
|
||||||
EmitTunnelEvent("tunnels.expired", expiredTunnel);
|
EmitTunnelEvent("tunnels.expired", expiredTunnel);
|
||||||
|
|
||||||
expiredTunnel->SetTunnelPool (nullptr);
|
expiredTunnel->SetTunnelPool (nullptr);
|
||||||
for (auto& it: m_Tests)
|
for (auto& it: m_Tests)
|
||||||
if (it.second.second == expiredTunnel) it.second.second = nullptr;
|
if (it.second.second == expiredTunnel) it.second.second = nullptr;
|
||||||
|
@ -109,7 +109,6 @@ namespace tunnel
|
||||||
if (expiredTunnel)
|
if (expiredTunnel)
|
||||||
{
|
{
|
||||||
EmitTunnelEvent("tunnels.expired", expiredTunnel);
|
EmitTunnelEvent("tunnels.expired", expiredTunnel);
|
||||||
|
|
||||||
expiredTunnel->SetTunnelPool (nullptr);
|
expiredTunnel->SetTunnelPool (nullptr);
|
||||||
for (auto& it: m_Tests)
|
for (auto& it: m_Tests)
|
||||||
if (it.second.first == expiredTunnel) it.second.first = nullptr;
|
if (it.second.first == expiredTunnel) it.second.first = nullptr;
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
#ifndef WEBSOCKET_H__
|
#ifndef WEBSOCKET_H__
|
||||||
#define WEBSOCKET_H__
|
#define WEBSOCKET_H__
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
|
|
||||||
|
|
||||||
namespace i2p
|
namespace i2p
|
||||||
{
|
{
|
||||||
namespace event
|
namespace event
|
||||||
|
|
Loading…
Add table
Reference in a new issue