aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfuzzard <fuzzard@users.noreply.github.com>2023-12-04 17:22:24 +1000
committerGitHub <noreply@github.com>2023-12-04 17:22:24 +1000
commitc691b00592303515f2e55c26d2ae12e699e6cf03 (patch)
tree1c420f3dc3a477c5c50c0c305914114fc3238ac5
parent2a28a56a0f278e4fe2f6f9079298a63e1386bede (diff)
parent7a7e3aa26647e7b0127093a4cf33e6b90ab79e8e (diff)
Merge pull request #23875 from a1rwulf/fix-websocket-pong
Fix websocket pong
-rw-r--r--xbmc/network/TCPServer.cpp3
-rw-r--r--xbmc/network/websocket/WebSocket.cpp2
-rw-r--r--xbmc/network/websocket/WebSocket.h2
-rw-r--r--xbmc/network/websocket/WebSocketV8.h5
4 files changed, 8 insertions, 4 deletions
diff --git a/xbmc/network/TCPServer.cpp b/xbmc/network/TCPServer.cpp
index cd055c4ade..75334245b4 100644
--- a/xbmc/network/TCPServer.cpp
+++ b/xbmc/network/TCPServer.cpp
@@ -719,7 +719,8 @@ void CTCPServer::CWebSocketClient::PushBuffer(CTCPServer *host, const char *buff
if (send)
{
for (unsigned int index = 0; index < frames.size(); index++)
- Send(frames.at(index)->GetFrameData(), (unsigned int)frames.at(index)->GetFrameLength());
+ CTCPClient::Send(frames.at(index)->GetFrameData(),
+ static_cast<unsigned int>(frames.at(index)->GetFrameLength()));
}
else
{
diff --git a/xbmc/network/websocket/WebSocket.cpp b/xbmc/network/websocket/WebSocket.cpp
index ecec4efeee..5051c27f22 100644
--- a/xbmc/network/websocket/WebSocket.cpp
+++ b/xbmc/network/websocket/WebSocket.cpp
@@ -325,7 +325,7 @@ const CWebSocketMessage* CWebSocket::Handle(const char* &buffer, size_t &length,
case WebSocketPing:
msg = GetMessage();
if (msg != NULL)
- msg->AddFrame(Pong(frame->GetApplicationData()));
+ msg->AddFrame(Pong(frame->GetApplicationData(), frame->GetLength()));
break;
case WebSocketConnectionClose:
diff --git a/xbmc/network/websocket/WebSocket.h b/xbmc/network/websocket/WebSocket.h
index 8901edeca5..9b7ca7ff38 100644
--- a/xbmc/network/websocket/WebSocket.h
+++ b/xbmc/network/websocket/WebSocket.h
@@ -121,7 +121,7 @@ public:
virtual const CWebSocketMessage* Handle(const char* &buffer, size_t &length, bool &send);
virtual const CWebSocketMessage* Send(WebSocketFrameOpcode opcode, const char* data = NULL, uint32_t length = 0);
virtual const CWebSocketFrame* Ping(const char* data = NULL) const = 0;
- virtual const CWebSocketFrame* Pong(const char* data = NULL) const = 0;
+ virtual const CWebSocketFrame* Pong(const char* data, uint32_t length) const = 0;
virtual const CWebSocketFrame* Close(WebSocketCloseReason reason = WebSocketCloseNormal, const std::string &message = "") = 0;
virtual void Fail() = 0;
diff --git a/xbmc/network/websocket/WebSocketV8.h b/xbmc/network/websocket/WebSocketV8.h
index d86688cdcf..0214975279 100644
--- a/xbmc/network/websocket/WebSocketV8.h
+++ b/xbmc/network/websocket/WebSocketV8.h
@@ -19,7 +19,10 @@ public:
bool Handshake(const char* data, size_t length, std::string &response) override;
const CWebSocketFrame* Ping(const char* data = NULL) const override { return new CWebSocketFrame(WebSocketPing, data); }
- const CWebSocketFrame* Pong(const char* data = NULL) const override { return new CWebSocketFrame(WebSocketPong, data); }
+ const CWebSocketFrame* Pong(const char* data, uint32_t length) const override
+ {
+ return new CWebSocketFrame(WebSocketPong, data, length);
+ }
const CWebSocketFrame* Close(WebSocketCloseReason reason = WebSocketCloseNormal, const std::string &message = "") override;
void Fail() override;