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
|
2019-05-09 20:28:56 +00:00
|
|
|
_InboundMessage::IsExpired(llarp_time_t now) const
|
2019-03-29 14:03:07 +00:00
|
|
|
{
|
|
|
|
return now > lastActive && now - lastActive >= 2000;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2019-05-09 20:28:56 +00:00
|
|
|
_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-05-09 20:28:56 +00:00
|
|
|
|
2019-03-29 14:03:07 +00:00
|
|
|
} // namespace utp
|
|
|
|
|
|
|
|
} // namespace llarp
|