* Prints the connection size for the provided connection. * @param socket socket ptr * @param connection connection whose size will be returned. */
| 166 | * @param connection connection whose size will be returned. |
| 167 | */ |
| 168 | int getConnectionSize(std::unique_ptr<minifi::io::Socket> socket, std::ostream &out, std::string connection) { |
| 169 | socket->initialize(); |
| 170 | std::vector<uint8_t> data; |
| 171 | uint8_t op = minifi::c2::Operation::DESCRIBE; |
| 172 | minifi::io::BufferStream stream; |
| 173 | stream.write(&op, 1); |
| 174 | stream.write("queue"); |
| 175 | stream.write(connection); |
| 176 | if (socket->write(const_cast<uint8_t*>(stream.getBuffer()), gsl::narrow<int>(stream.size())) < 0) { |
| 177 | return -1; |
| 178 | } |
| 179 | // read the response |
| 180 | uint8_t resp = 0; |
| 181 | socket->read(&resp, 1); |
| 182 | if (resp == minifi::c2::Operation::DESCRIBE) { |
| 183 | std::string size; |
| 184 | socket->read(size); |
| 185 | out << "Size/Max of " << connection << " " << size << std::endl; |
| 186 | } |
| 187 | return 0; |
| 188 | } |
| 189 | |
| 190 | int listComponents(std::unique_ptr<minifi::io::Socket> socket, std::ostream &out, bool show_header = true) { |
| 191 | socket->initialize(); |