Skip to content

Fix network connect and logging#1911

Open
michaelortmann wants to merge 4 commits into
eggheads:developfrom
michaelortmann:log.eof.read
Open

Fix network connect and logging#1911
michaelortmann wants to merge 4 commits into
eggheads:developfrom
michaelortmann:log.eof.read

Conversation

@michaelortmann

@michaelortmann michaelortmann commented Jun 13, 2026

Copy link
Copy Markdown
Member

Found by: michaelortmann
Patch by: michaelortmann
Fixes:

One-line summary:
Fix network connect and logging

Additional description (if needed):
For unblocking connect() select returns. This PR adds a getsockopt() check to detect eof/unsuccessful connect early, before attempting to read(). Also log messages were enhanced.

Test cases demonstrating functionality (if applicable):
Set an irc server that is unreachable and .set console +*
Before:

[05:42:20] Trying server 192.168.16.141:6667
[05:42:20] net: open_telnet_raw(): idx 4 host 192.168.16.141 ip 192.168.16.141 port 6667 ssl 0
[05:42:20] [!m] CAP LS 302
[05:42:20] [m->] CAP LS 302
[05:42:20] [!m] NICK BotA
[05:42:20] [m->] NICK BotA
[05:42:20] [!m] USER BotA . . :A deranged product of evil coders
[05:42:20] [m->] USER BotA . . :A deranged product of evil coders
[05:42:23] net: connect! sock 8
[05:42:23] Connected to 192.168.16.141
[05:42:23] [@] 
[05:42:23] net: eof!(read) socket 8
[05:42:23] Disconnected from 192.168.16.141

After:

[05:43:32] Trying server 192.168.16.141:6667
[05:43:32] net: open_telnet_raw(): idx 4 host 192.168.16.141 ip 192.168.16.141 port 6667 ssl 0
[05:43:32] [!m] CAP LS 302
[05:43:32] [m->] CAP LS 302
[05:43:32] [!m] NICK BotA
[05:43:32] [m->] NICK BotA
[05:43:32] [!m] USER BotA . . :A deranged product of evil coders
[05:43:32] [m->] USER BotA . . :A deranged product of evil coders
[05:43:35] net: connect! sock 8 error No route to host
[05:43:35] Disconnected from 192.168.16.141

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fa6cae0a17

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/net.c Outdated
@michaelortmann michaelortmann changed the title Enhance network logging (WIP) Enhance network logging Jun 13, 2026
@michaelortmann michaelortmann changed the title (WIP) Enhance network logging Fix network connect and logging Jun 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant