mirror of
https://github.com/oxen-io/lokinet.git
synced 2024-10-29 11:05:43 +00:00
28 lines
498 B
C++
28 lines
498 B
C++
#include <utp/inbound_message.hpp>
|
|
|
|
#include <cstring>
|
|
|
|
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;
|
|
std::copy_n(ptr, sz, buffer.cur);
|
|
buffer.cur += sz;
|
|
return true;
|
|
}
|
|
|
|
} // namespace utp
|
|
|
|
} // namespace llarp
|