mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[wpinet] WebSocket: Send pong in response to ping (#5498)
This is required by the spec (RFC 6455 section 5.5.2).
This commit is contained in:
@@ -573,6 +573,19 @@ void WebSocket::HandleIncoming(uv::Buffer& buf, size_t size) {
|
||||
if (!fin) {
|
||||
return Fail(1002, "cannot fragment control frames");
|
||||
}
|
||||
// If the connection is open, send a Pong in response
|
||||
if (m_state == OPEN) {
|
||||
SmallVector<uv::Buffer, 4> bufs;
|
||||
{
|
||||
raw_uv_ostream os{bufs, 4096};
|
||||
os << m_payload;
|
||||
}
|
||||
SendPong(bufs, [](auto bufs, uv::Error) {
|
||||
for (auto&& buf : bufs) {
|
||||
buf.Deallocate();
|
||||
}
|
||||
});
|
||||
}
|
||||
ping(m_payload);
|
||||
break;
|
||||
case kOpPong:
|
||||
|
||||
Reference in New Issue
Block a user