Enhance WebSocket connection management and signer implementation
Some checks failed
Go / build (push) Has been cancelled
Go / release (push) Has been cancelled

- Added a pong handler to extend the read deadline upon receiving PONG messages in WebSocket connections, improving connection stability.
- Updated the signer implementation to serialize the x-only public key to 32 bytes, ensuring compatibility with the internal format.
- Refactored tests to utilize MustNew() for signer initialization, enhancing error handling during key generation.
- Bumped version to v0.25.1 to reflect these updates.
This commit is contained in:
2025-11-05 06:19:28 +00:00
parent 4944bfad91
commit 1d12099f1c
5 changed files with 30 additions and 15 deletions

View File

@@ -76,6 +76,12 @@ whitelist:
// Set initial read deadline - pong handler will extend it when pongs are received
conn.SetReadDeadline(time.Now().Add(DefaultPongWait))
// Add pong handler to extend read deadline when client responds to pings
conn.SetPongHandler(func(string) error {
log.T.F("received PONG from %s, extending read deadline", remote)
return conn.SetReadDeadline(time.Now().Add(DefaultPongWait))
})
defer conn.Close()
listener := &Listener{
ctx: ctx,
@@ -231,6 +237,10 @@ func (s *Server) Pinger(
defer func() {
log.D.F("pinger shutting down")
ticker.Stop()
// Recover from panic if channel is closed
if r := recover(); r != nil {
log.D.F("pinger recovered from panic (channel likely closed): %v", r)
}
}()
pingCount := 0
for {