Merge pull request #194 from michael-loki/fixes

Minor build fixes
This commit is contained in:
Ryan Tharp 2019-01-03 13:32:44 -08:00 committed by GitHub
commit 1ab3a7abd1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 17 additions and 9 deletions

View File

@ -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

View File

@ -1,7 +1,9 @@
#include <crypto.hpp>
#include <fstream>
#include <buffer.hpp>
#include <fstream>
#include <iterator>
namespace llarp
{
bool

View File

@ -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,7 +436,9 @@ 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;
}

View File

@ -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

View File

@ -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

View File

@ -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;
}