Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions ixwebsocket/IXSelectInterruptPipe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ namespace ix
return ret == 8;
}

// TODO: return max uint64_t for errors ?
uint64_t SelectInterruptPipe::read()
{
std::lock_guard<std::mutex> lock(_fildesMutex);
Expand All @@ -140,11 +139,11 @@ namespace ix

uint64_t value = 0;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's wrong with ret for a variable name ?

Copy link
Copy Markdown
Contributor Author

@cosminpolifronie cosminpolifronie Apr 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing inherently wrong, just gave me the impression that it will be used as the return value for the whole function at first. Just makes the code a bit faster to read for me.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. In general it's better to keep PR to the minimum viable change, this is just marginally better and debatable, it's about taste I like short names better as long as they aren't cryptic like x.

ssize_t ret = -1;
ssize_t readret = -1;
do
{
ret = ::read(fd, &value, sizeof(value));
} while (ret == -1 && errno == EINTR);
readret = ::read(fd, &value, sizeof(value));
} while (readret == -1 && errno == EINTR);

return value;
}
Expand Down
4 changes: 1 addition & 3 deletions ixwebsocket/IXSocketConnect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include <linux/in.h>
#include <linux/tcp.h>
#endif
#include <ixwebsocket/IXSelectInterruptFactory.h>

namespace ix
{
Expand Down Expand Up @@ -67,8 +66,7 @@ namespace ix

int timeoutMs = 10;
bool readyToRead = false;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's because we don't call init() on that object.

bool SelectInterruptPipe::init(std::string& errorMsg)

Can you try that, this should become a one liner fix.

Copy link
Copy Markdown
Contributor Author

@cosminpolifronie cosminpolifronie Apr 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this be needed at this stage? As far as I understand from the code the SelectInterrupt is never used again, it was there just to be able to call poll().

SelectInterruptPtr selectInterrupt = ix::createSelectInterrupt();
PollResultType pollResult = Socket::poll(readyToRead, timeoutMs, fd, selectInterrupt);
PollResultType pollResult = Socket::poll(readyToRead, timeoutMs, fd, nullptr);

if (pollResult == PollResultType::Timeout)
{
Expand Down
Loading