Skip to content

Commit

Permalink
clear pingData before writing new data
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-fowler committed Dec 30, 2024
1 parent 06e5e25 commit beeea9e
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions Sources/WSCore/WebSocketStateMachine.swift
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ struct WebSocketStateMachine {
}
// creating random payload
let random = (0..<Self.pingDataSize).map { _ in UInt8.random(in: 0...255) }
state.pingData.clear()
state.pingData.writeBytes(random)
state.lastPingTime = .now
self.state = .open(state)
Expand Down

0 comments on commit beeea9e

Please sign in to comment.