Skip to content

Commit

Permalink
Remove useless condition
Browse files Browse the repository at this point in the history
  • Loading branch information
uweseimet committed Sep 7, 2023
1 parent 865e04d commit 58c50b8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
13 changes: 2 additions & 11 deletions cpp/devices/ctapdriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ bool CTapDriver::Disable() const
return result;
}

void CTapDriver::Flush()
void CTapDriver::Flush() const
{
while (PendingPackets()) {
array<uint8_t, ETH_FRAME_LEN> m_garbage_buffer;
Expand All @@ -386,11 +386,6 @@ void CTapDriver::GetMacAddr(uint8_t *mac) const
memcpy(mac, m_MacAddr.data(), m_MacAddr.size());
}

//---------------------------------------------------------------------------
//
// Receive
//
//---------------------------------------------------------------------------
bool CTapDriver::PendingPackets() const
{
assert(m_hTAP != -1);
Expand All @@ -402,11 +397,7 @@ bool CTapDriver::PendingPackets() const
fds.revents = 0;
poll(&fds, 1, 0);
spdlog::trace(to_string(fds.revents) + " revents");
if (!(fds.revents & POLLIN)) {
return false;
} else {
return true;
}
return !(fds.revents & POLLIN);
}

// See https://stackoverflow.com/questions/21001659/crc32-algorithm-implementation-in-c-without-a-look-up-table-and-with-a-public-li
Expand Down
2 changes: 1 addition & 1 deletion cpp/devices/ctapdriver.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class CTapDriver
bool PendingPackets() const; // Check if there are IP packets available
bool Enable() const; // Enable the piscsi0 interface
bool Disable() const; // Disable the piscsi0 interface
void Flush(); // Purge all of the packets that are waiting to be processed
void Flush() const; // Purge all of the packets that are waiting to be processed

static uint32_t Crc32(span<const uint8_t>);

Expand Down

0 comments on commit 58c50b8

Please sign in to comment.