mirror of
https://github.com/boostorg/redis.git
synced 2026-02-22 03:32:22 +00:00
Progresses removing stream class. Improvements in the pubsub example.
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
#include <aedis/aedis.hpp>
|
||||
@@ -24,19 +25,18 @@ using namespace aedis;
|
||||
net::awaitable<void> ping()
|
||||
{
|
||||
auto socket = co_await make_connection();
|
||||
resp3::stream<tcp_socket> stream{std::move(socket)};
|
||||
|
||||
resp3::request req;
|
||||
req.push(command::hello, 3);
|
||||
req.push(command::ping);
|
||||
req.push(command::quit);
|
||||
co_await async_write(socket, req);
|
||||
|
||||
co_await stream.async_write(req);
|
||||
|
||||
std::string buffer;
|
||||
resp3::response resp;
|
||||
co_await stream.async_read(resp);
|
||||
co_await stream.async_read(resp);
|
||||
co_await stream.async_read(resp);
|
||||
co_await async_read(socket, buffer, resp);
|
||||
co_await async_read(socket, buffer, resp);
|
||||
co_await async_read(socket, buffer, resp);
|
||||
|
||||
std::cout << resp << std::endl;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user