| 90 | } |
| 91 | |
| 92 | String KeeperClient::executeFourLetterCommand(const String & command) |
| 93 | { |
| 94 | /// We need to create a new socket every time because ZooKeeper forcefully shuts down the connection after a four-letter-word command. |
| 95 | Poco::Net::StreamSocket socket; |
| 96 | socket.connect(Poco::Net::SocketAddress{zk_args.hosts[0]}, zk_args.connection_timeout_ms * 1000); |
| 97 | |
| 98 | socket.setReceiveTimeout(zk_args.operation_timeout_ms * 1000); |
| 99 | socket.setSendTimeout(zk_args.operation_timeout_ms * 1000); |
| 100 | socket.setNoDelay(true); |
| 101 | |
| 102 | ReadBufferFromPocoSocket in(socket); |
| 103 | WriteBufferFromPocoSocket out(socket); |
| 104 | |
| 105 | out.write(command.data(), command.size()); |
| 106 | out.next(); |
| 107 | out.finalize(); |
| 108 | |
| 109 | String result; |
| 110 | readStringUntilEOF(result, in); |
| 111 | in.next(); |
| 112 | return result; |
| 113 | } |
| 114 | |
| 115 | |
| 116 | /// `prefix` is the full input line up to the cursor position, as provided by replxx. |
nothing calls this directly
no test coverage detected