lokinet/llarp/utp/inbound_message.cpp

28 lines
496 B
C++
Raw Normal View History

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