Skip to content

Conversation

alexandear
Copy link

@alexandear alexandear commented Jul 4, 2025

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update
  • Go Version Update
  • Dependency Update

Description

This PR fixes a possible panic in tests. When err is not nil in newWebsocketServer, websocketServer is nil, and defer websocketServer.Close() will panic. The same applies to the newProxyServer function.

Added/updated tests?

  • Yes
  • No, and this is why: please replace this line with details on why tests
    have not been included
  • I need help with writing tests

@tollwayclout
Copy link

The change in this PR is good.

This panic is not the only problem with an error return from the function newWebsocketServer. The function newWebsocketServer leaks a listener when returning an error. That function should websocketServer.Close() when returning an error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants