Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't run tcp listener if tcp.listen not configured #31

Merged
merged 1 commit into from
Jan 16, 2024

Conversation

wlcx
Copy link
Contributor

@wlcx wlcx commented Jan 16, 2024

Previously, the TCP listener would listen on a random port if no tcp.listen was configured.

@russss russss merged commit 60526f6 into irccloud:master Jan 16, 2024
1 check passed
edwinbalani added a commit to edwinbalani/irccat that referenced this pull request Mar 31, 2024
After 60526f6 (irccloud#31),
`irccat.tcp.Run(irccat.irc)` is called (if the config calls for it)
before, rather than after, `irccat.connectIRC()`, which changes
`irccat.irc` away from a nil pointer in the first place.  This pointer
is copied into the `irc` field of a TCPListener `l` by
`irccat.tcp.Run()`.

A panic won't actually happen until the TCP listener handles its first
message, if it ever comes, and in doing so passes the nil pointer
further down to `dispatcher.Send(l.irc, ...)`.

To fix, bring the call to `irccat.connectIRC()` forward again, to before
any listener setup is done at all.  This probably makes sense
stylistically too.
russss pushed a commit that referenced this pull request Apr 3, 2024
After 60526f6 (#31),
`irccat.tcp.Run(irccat.irc)` is called (if the config calls for it)
before, rather than after, `irccat.connectIRC()`, which changes
`irccat.irc` away from a nil pointer in the first place.  This pointer
is copied into the `irc` field of a TCPListener `l` by
`irccat.tcp.Run()`.

A panic won't actually happen until the TCP listener handles its first
message, if it ever comes, and in doing so passes the nil pointer
further down to `dispatcher.Send(l.irc, ...)`.

To fix, bring the call to `irccat.connectIRC()` forward again, to before
any listener setup is done at all.  This probably makes sense
stylistically too.
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.

2 participants