* Lists connections which are full * @param socket socket ptr */
| 101 | * @param socket socket ptr |
| 102 | */ |
| 103 | int getFullConnections(std::unique_ptr<minifi::io::Socket> socket, std::ostream &out) { |
| 104 | socket->initialize(); |
| 105 | std::vector<uint8_t> data; |
| 106 | uint8_t op = minifi::c2::Operation::DESCRIBE; |
| 107 | minifi::io::BufferStream stream; |
| 108 | stream.write(&op, 1); |
| 109 | stream.write("getfull"); |
| 110 | if (socket->write(const_cast<uint8_t*>(stream.getBuffer()), gsl::narrow<int>(stream.size())) < 0) { |
| 111 | return -1; |
| 112 | } |
| 113 | // read the response |
| 114 | uint8_t resp = 0; |
| 115 | socket->read(&resp, 1); |
| 116 | if (resp == minifi::c2::Operation::DESCRIBE) { |
| 117 | uint16_t connections = 0; |
| 118 | socket->read(connections); |
| 119 | out << connections << " are full" << std::endl; |
| 120 | for (int i = 0; i < connections; i++) { |
| 121 | std::string fullcomponent; |
| 122 | socket->read(fullcomponent); |
| 123 | out << fullcomponent << " is full" << std::endl; |
| 124 | } |
| 125 | } |
| 126 | return 0; |
| 127 | } |
| 128 | |
| 129 | int getJstacks(std::unique_ptr<minifi::io::Socket> socket, std::ostream &out) { |
| 130 | socket->initialize(); |