mirror of
https://github.com/oxen-io/lokinet.git
synced 2024-11-19 09:25:28 +00:00
commit
1ab3a7abd1
@ -116,7 +116,7 @@ if(NOT DEBIAN)
|
||||
endif(NOT DEBIAN)
|
||||
|
||||
if(ASAN)
|
||||
set(DEBUG_FLAGS "${DEBUG_FLAGS} -fsanitize=address -fno-omit-frame-pointer")
|
||||
set(DEBUG_FLAGS ${DEBUG_FLAGS} -fsanitize=address -fno-omit-frame-pointer)
|
||||
set(OPTIMIZE_FLAGS "-O0")
|
||||
endif(ASAN)
|
||||
|
||||
@ -146,6 +146,7 @@ endif(SHADOW)
|
||||
if(CMAKE_BUILD_TYPE MATCHES "[Dd][Ee][Bb][Uu][Gg]")
|
||||
set(OPTIMIZE_FLAGS "")
|
||||
add_compile_options( ${DEBUG_FLAGS} )
|
||||
link_libraries( ${DEBUG_FLAGS} )
|
||||
endif(CMAKE_BUILD_TYPE MATCHES "[Dd][Ee][Bb][Uu][Gg]")
|
||||
|
||||
# Add non-386 target-specific options here
|
||||
|
@ -1,7 +1,9 @@
|
||||
#include <crypto.hpp>
|
||||
#include <fstream>
|
||||
#include <buffer.hpp>
|
||||
|
||||
#include <fstream>
|
||||
#include <iterator>
|
||||
|
||||
namespace llarp
|
||||
{
|
||||
bool
|
||||
|
@ -417,12 +417,12 @@ struct llarp_kqueue_loop : public llarp_ev_loop
|
||||
int
|
||||
tick(int ms)
|
||||
{
|
||||
struct kevent events[1024];
|
||||
std::array< struct kevent, 1024 > events;
|
||||
int result;
|
||||
timespec t;
|
||||
t.tv_sec = 0;
|
||||
t.tv_nsec = ms * 1000000UL;
|
||||
result = kevent(kqueuefd, nullptr, 0, events, 1024, &t);
|
||||
result = kevent(kqueuefd, nullptr, 0, events.data(), events.size(), &t);
|
||||
// result: 0 is a timeout
|
||||
if(result > 0)
|
||||
{
|
||||
@ -436,8 +436,10 @@ struct llarp_kqueue_loop : public llarp_ev_loop
|
||||
ev->read(readbuf,
|
||||
std::min(sizeof(readbuf), size_t(events[idx].data)));
|
||||
if(events[idx].filter & EVFILT_WRITE)
|
||||
{
|
||||
ev->flush_write_buffers(events[idx].data);
|
||||
}
|
||||
}
|
||||
++idx;
|
||||
}
|
||||
}
|
||||
|
@ -1064,7 +1064,7 @@ namespace llarp
|
||||
|
||||
// get message
|
||||
if(m_RecvMsgs.find(msgid) == m_RecvMsgs.end())
|
||||
m_RecvMsgs.emplace(std::make_pair(msgid, InboundMessage{}));
|
||||
m_RecvMsgs.emplace(msgid, InboundMessage{});
|
||||
|
||||
auto itr = m_RecvMsgs.find(msgid);
|
||||
// add message activity
|
||||
|
@ -55,7 +55,11 @@ namespace llarp
|
||||
MessageBuffer _msg;
|
||||
|
||||
/// for accessing message buffer
|
||||
llarp_buffer_t buffer = _msg.as_buffer();
|
||||
llarp_buffer_t buffer;
|
||||
|
||||
InboundMessage() : lastActive(0), _msg(), buffer(_msg.as_buffer())
|
||||
{
|
||||
}
|
||||
|
||||
bool
|
||||
operator==(const InboundMessage& other) const
|
||||
|
@ -100,8 +100,8 @@ namespace llarp
|
||||
lock_t lock(m_ProfilesMutex);
|
||||
size_t sz = (m_Profiles.size() * (RouterProfile::MaxSize + 32 + 8)) + 8;
|
||||
|
||||
byte_t* tmp = new byte_t[sz];
|
||||
auto buf = llarp::InitBuffer(tmp, sz);
|
||||
std::vector<byte_t> tmp(sz, 0);
|
||||
auto buf = llarp::Buffer(tmp);
|
||||
auto res = BEncode(&buf);
|
||||
if(res)
|
||||
{
|
||||
@ -113,7 +113,6 @@ namespace llarp
|
||||
f.write((char*)buf.base, buf.sz);
|
||||
}
|
||||
}
|
||||
delete[] tmp;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user