lokinet/llarp/utp/inbound_message.cpp
2019-05-11 09:52:44 -04:00

28 lines
496 B
C++

#include <utp/inbound_message.hpp>
#include <string.h>
namespace llarp
{
namespace utp
{
bool
_InboundMessage::IsExpired(llarp_time_t now) const
{
return now > lastActive && now - lastActive >= 2000;
}
bool
_InboundMessage::AppendData(const byte_t* ptr, uint16_t sz)
{
if(buffer.size_left() < sz)
return false;
memcpy(buffer.cur, ptr, sz);
buffer.cur += sz;
return true;
}
} // namespace utp
} // namespace llarp