Fix read problem in linux

errno is only set if read returns < 0 and won't be set to 0 if read
succeeds, so we were bailing here frequently on successful reads
(whenever errno happened to be non-0).
pull/1969/head
Jason Rhinelander 2 years ago
parent 15443568db
commit b9c9ee1ca7
No known key found for this signature in database
GPG Key ID: C4992CE7A88D4262

@ -110,7 +110,7 @@ namespace llarp::vpn
std::vector<byte_t> pkt;
pkt.resize(net::IPPacket::MaxSize);
const auto sz = read(m_fd, pkt.data(), pkt.capacity());
if (errno)
if (sz < 0)
{
if (errno == EAGAIN or errno == EWOULDBLOCK)
{

Loading…
Cancel
Save