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
@ghost
Copy link

ghost commented Aug 30, 2025

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

1 participant