Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions internal/signaling/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func Handler(ctx context.Context, store stores.Store, cloudflare *cloudflare.Cre
}
defer func() {
logger.Info("peer websocket closed", zap.String("peer", peer.ID), zap.String("game", peer.Game), zap.String("origin", r.Header.Get("Origin")))
conn.Close(websocket.StatusInternalError, "unexpected closure")
conn.Close(websocket.StatusInternalError, "unexpected closure") // nolint:errcheck

if !peer.closedPacketReceived {
// At this point ctx has already been cancelled, so we create a new one to use for the disconnect.
Expand All @@ -82,8 +82,8 @@ func Handler(ctx context.Context, store stores.Store, cloudflare *cloudflare.Cre
}
}()

go func() { // Sending ping packet every 30 to check if the tcp connection is still alive.
ticker := time.NewTicker(30 * time.Second)
go func() { // Sending ping packet every 2 seconds to check if the tcp connection is still alive.
ticker := time.NewTicker(2 * time.Second)
defer ticker.Stop()
for {
select {
Expand Down