Skip to content

Commit

Permalink
Add IsSelectResultValid to LayerImplSelect (#13776)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexhqwang authored and pull[bot] committed Nov 14, 2023
1 parent 70614bb commit 8c197ad
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/system/SystemLayerImplSelect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ void LayerImplSelect::HandleEvents()
{
assertChipStackLockedByCurrentThread();

if (mSelectResult < 0)
if (!IsSelectResultValid())
{
ChipLogError(DeviceLayer, "select failed: %s\n", ErrorStr(CHIP_ERROR_POSIX(errno)));
return;
Expand Down
3 changes: 3 additions & 0 deletions src/system/SystemLayerImplSelect.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ class LayerImplSelect : public LayerSocketsLoop
void HandleTimerComplete(TimerList::Node * timer);
#endif // CHIP_SYSTEM_CONFIG_USE_DISPATCH

// Expose the result of WaitForEvents() for non-blocking socket implementations.
bool IsSelectResultValid() const { return mSelectResult >= 0; }

protected:
static SocketEvents SocketEventsFromFDs(int socket, const fd_set & readfds, const fd_set & writefds, const fd_set & exceptfds);

Expand Down

0 comments on commit 8c197ad

Please sign in to comment.