fix: supprot PING/PONG
This commit is contained in:
@@ -25,10 +25,11 @@ RedisSession::startReceive()
|
|||||||
auto self = weak_self.lock();
|
auto self = weak_self.lock();
|
||||||
if (!self) { return; }
|
if (!self) { return; }
|
||||||
if (!ec) {
|
if (!ec) {
|
||||||
|
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"));
|
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();
|
OnClose();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
startReceive();
|
startReceive();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user