fix: supprot PING/PONG

This commit is contained in:
tqcq
2025-09-09 19:43:06 +08:00
parent ae28a458b7
commit 0e1230d011

View File

@@ -25,10 +25,11 @@ RedisSession::startReceive()
auto self = weak_self.lock();
if (!self) { return; }
if (!ec) {
auto sent = _socket.send(asio::buffer("+PONG\r\n"));
LOGI("sent to {}:{} 7 bytes", _socket.remote_endpoint().address().to_string(),
_socket.remote_endpoint().port());
OnClose();
std::string recv(_recv_buf.data(), received);
if (recv == "*1\r\n$4\r\nPING\r\n") {
auto sent = _socket.send(asio::buffer("+PONG\r\n"));
OnClose();
}
} else {
startReceive();
}