Merge pull request #194 from michael-loki/fixes

Minor build fixes
pull/195/head
Ryan Tharp 6 years ago committed by GitHub
commit 1ab3a7abd1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -116,7 +116,7 @@ if(NOT DEBIAN)
endif(NOT DEBIAN) endif(NOT DEBIAN)
if(ASAN) 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") set(OPTIMIZE_FLAGS "-O0")
endif(ASAN) endif(ASAN)
@ -146,6 +146,7 @@ endif(SHADOW)
if(CMAKE_BUILD_TYPE MATCHES "[Dd][Ee][Bb][Uu][Gg]") if(CMAKE_BUILD_TYPE MATCHES "[Dd][Ee][Bb][Uu][Gg]")
set(OPTIMIZE_FLAGS "") set(OPTIMIZE_FLAGS "")
add_compile_options( ${DEBUG_FLAGS} ) add_compile_options( ${DEBUG_FLAGS} )
link_libraries( ${DEBUG_FLAGS} )
endif(CMAKE_BUILD_TYPE MATCHES "[Dd][Ee][Bb][Uu][Gg]") endif(CMAKE_BUILD_TYPE MATCHES "[Dd][Ee][Bb][Uu][Gg]")
# Add non-386 target-specific options here # Add non-386 target-specific options here

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

@ -417,12 +417,12 @@ struct llarp_kqueue_loop : public llarp_ev_loop
int int
tick(int ms) tick(int ms)
{ {
struct kevent events[1024]; std::array< struct kevent, 1024 > events;
int result; int result;
timespec t; timespec t;
t.tv_sec = 0; t.tv_sec = 0;
t.tv_nsec = ms * 1000000UL; 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 // result: 0 is a timeout
if(result > 0) if(result > 0)
{ {
@ -436,7 +436,9 @@ struct llarp_kqueue_loop : public llarp_ev_loop
ev->read(readbuf, ev->read(readbuf,
std::min(sizeof(readbuf), size_t(events[idx].data))); std::min(sizeof(readbuf), size_t(events[idx].data)));
if(events[idx].filter & EVFILT_WRITE) if(events[idx].filter & EVFILT_WRITE)
{
ev->flush_write_buffers(events[idx].data); ev->flush_write_buffers(events[idx].data);
}
} }
++idx; ++idx;
} }

@ -1064,7 +1064,7 @@ namespace llarp
// get message // get message
if(m_RecvMsgs.find(msgid) == m_RecvMsgs.end()) 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); auto itr = m_RecvMsgs.find(msgid);
// add message activity // add message activity

@ -55,7 +55,11 @@ namespace llarp
MessageBuffer _msg; MessageBuffer _msg;
/// for accessing message buffer /// for accessing message buffer
llarp_buffer_t buffer = _msg.as_buffer(); llarp_buffer_t buffer;
InboundMessage() : lastActive(0), _msg(), buffer(_msg.as_buffer())
{
}
bool bool
operator==(const InboundMessage& other) const operator==(const InboundMessage& other) const

@ -100,8 +100,8 @@ namespace llarp
lock_t lock(m_ProfilesMutex); lock_t lock(m_ProfilesMutex);
size_t sz = (m_Profiles.size() * (RouterProfile::MaxSize + 32 + 8)) + 8; size_t sz = (m_Profiles.size() * (RouterProfile::MaxSize + 32 + 8)) + 8;
byte_t* tmp = new byte_t[sz]; std::vector<byte_t> tmp(sz, 0);
auto buf = llarp::InitBuffer(tmp, sz); auto buf = llarp::Buffer(tmp);
auto res = BEncode(&buf); auto res = BEncode(&buf);
if(res) if(res)
{ {
@ -113,7 +113,6 @@ namespace llarp
f.write((char*)buf.base, buf.sz); f.write((char*)buf.base, buf.sz);
} }
} }
delete[] tmp;
return res; return res;
} }

Loading…
Cancel
Save