1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
--- Makefile.linux.orig 2016-10-17 00:37:40.000000000 -0400
+++ Makefile.linux 2016-10-19 19:43:21.061181283 -0400
@@ -18,7 +18,7 @@
else ifeq ($(shell expr match ${CXXVER} "4\.[7-9]"),3) # >= 4.7
NEEDED_CXXFLAGS += -std=c++11 -D_GLIBCXX_USE_NANOSLEEP=1
else ifeq ($(shell expr match ${CXXVER} "4\.6"),3) # = 4.6
- NEEDED_CXXFLAGS += -std=c++0x
+ NEEDED_CXXFLAGS += -std=c++0x -D_GLIBCXX_USE_NANOSLEEP=1
else ifeq ($(shell expr match ${CXXVER} "[5-6]\.[0-9]"),3) # gcc >= 5.0
NEEDED_CXXFLAGS += -std=c++11
else # not supported
--- Tunnel.cpp.orig 2016-10-17 00:37:40.000000000 -0400
+++ Tunnel.cpp 2016-10-19 19:56:06.096526898 -0400
@@ -406,7 +406,7 @@
void Tunnels::AddTransitTunnel (std::shared_ptr<TransitTunnel> tunnel)
{
- if (m_Tunnels.emplace (tunnel->GetTunnelID (), tunnel).second)
+ if (m_Tunnels.insert (make_pair(tunnel->GetTunnelID (), tunnel)).second)
m_TransitTunnels.push_back (tunnel);
else
LogPrint (eLogError, "Tunnel: tunnel with id ", tunnel->GetTunnelID (), " already exists");
@@ -808,7 +808,7 @@
void Tunnels::AddInboundTunnel (std::shared_ptr<InboundTunnel> newTunnel)
{
- if (m_Tunnels.emplace (newTunnel->GetTunnelID (), newTunnel).second)
+ if (m_Tunnels.insert (make_pair(newTunnel->GetTunnelID (), newTunnel)).second)
{
m_InboundTunnels.push_back (newTunnel);
auto pool = newTunnel->GetTunnelPool ();
--- TunnelPool.h.orig
+++ TunnelPool.h
@@ -106,8 +106,8 @@ namespace tunnel
std::mutex m_CustomPeerSelectorMutex;
TunnelPeerSelector m_CustomPeerSelector;
- uint64_t m_MinLatency=0; // if > 0 this tunnel pool will try building tunnels with minimum latency by ms
- uint64_t m_MaxLatency=0; // if > 0 this tunnel pool will try building tunnels with maximum latency by ms
+ uint64_t m_MinLatency; // if > 0 this tunnel pool will try building tunnels with minimum latency by ms
+ uint64_t m_MaxLatency; // if > 0 this tunnel pool will try building tunnels with maximum latency by ms
public:
--- TunnelPool.cpp.orig
+++ TunnelPool.cpp
@@ -14,6 +14,12 @@
#include "Event.h"
#endif
+template<typename T> struct decltype_t {
+ typedef T type;
+};
+
+#define DECLTYPE(expr) decltype_t<decltype(expr)>::type
+
namespace i2p
{
namespace tunnel
@@ -22,7 +28,7 @@ namespace tunnel
TunnelPool::TunnelPool (int numInboundHops, int numOutboundHops, int numInboundTunnels, int numOutboundTunnels):
m_NumInboundHops (numInboundHops), m_NumOutboundHops (numOutboundHops),
m_NumInboundTunnels (numInboundTunnels), m_NumOutboundTunnels (numOutboundTunnels), m_IsActive (true),
- m_CustomPeerSelector(nullptr)
+ m_CustomPeerSelector(nullptr), m_MinLatency(0), m_MaxLatency(0)
{
}
@@ -322,7 +328,7 @@ namespace tunnel
buf += 4;
uint64_t timestamp = bufbe64toh (buf);
- decltype(m_Tests)::mapped_type test;
+ DECLTYPE(m_Tests)::mapped_type test;
bool found = false;
{
std::unique_lock<std::mutex> l(m_TestsMutex);
--- Event.h.orig
+++ Event.h
@@ -21,11 +21,12 @@
class EventCore
{
public:
+ EventCore(): m_listener(nullptr) {}
void QueueEvent(const EventType & ev);
void SetListener(EventListener * l);
private:
- EventListener * m_listener = nullptr;
+ EventListener * m_listener;
};
#ifdef WITH_EVENTS
extern EventCore core;
--- Log.cpp.orig
+++ Log.cpp
@@ -30,11 +30,11 @@
static const char *LogMsgColors[] = { "", "", "", "", "" };
#else /* UNIX */
static const char *LogMsgColors[] = {
- [eLogError] = "\033[1;31m", /* red */
- [eLogWarning] = "\033[1;33m", /* yellow */
- [eLogInfo] = "\033[1;36m", /* cyan */
- [eLogDebug] = "\033[1;34m", /* blue */
- [eNumLogLevels] = "\033[0m", /* reset */
+ "\033[1;31m", /* red */
+ "\033[1;33m", /* yellow */
+ "\033[1;36m", /* cyan */
+ "\033[1;34m", /* blue */
+ "\033[0m", /* reset */
};
#endif
|