| 4354 | } |
| 4355 | |
| 4356 | void addNodeReplyForClusterSlot(client *c, clusterNode *node, int start_slot, int end_slot) { |
| 4357 | int i, nested_elements = 3; /* slots (2) + master addr (1) */ |
| 4358 | void *nested_replylen = addReplyDeferredLen(c); |
| 4359 | addReplyLongLong(c, start_slot); |
| 4360 | addReplyLongLong(c, end_slot); |
| 4361 | addReplyArrayLen(c, 3); |
| 4362 | addReplyBulkCString(c, node->ip); |
| 4363 | /* Report non-TLS ports to non-TLS client in TLS cluster if available. */ |
| 4364 | int use_pport = (server.tls_cluster && |
| 4365 | c->conn && connGetType(c->conn) != CONN_TYPE_TLS); |
| 4366 | addReplyLongLong(c, use_pport && node->pport ? node->pport : node->port); |
| 4367 | addReplyBulkCBuffer(c, node->name, CLUSTER_NAMELEN); |
| 4368 | |
| 4369 | /* Remaining nodes in reply are replicas for slot range */ |
| 4370 | for (i = 0; i < node->numslaves; i++) { |
| 4371 | /* This loop is copy/pasted from clusterGenNodeDescription() |
| 4372 | * with modifications for per-slot node aggregation. */ |
| 4373 | if (nodeFailed(node->slaves[i])) continue; |
| 4374 | addReplyArrayLen(c, 3); |
| 4375 | addReplyBulkCString(c, node->slaves[i]->ip); |
| 4376 | /* Report slave's non-TLS port to non-TLS client in TLS cluster */ |
| 4377 | addReplyLongLong(c, (use_pport && node->slaves[i]->pport ? |
| 4378 | node->slaves[i]->pport : |
| 4379 | node->slaves[i]->port)); |
| 4380 | addReplyBulkCBuffer(c, node->slaves[i]->name, CLUSTER_NAMELEN); |
| 4381 | nested_elements++; |
| 4382 | } |
| 4383 | setDeferredArrayLen(c, nested_replylen, nested_elements); |
| 4384 | } |
| 4385 | |
| 4386 | void clusterReplyMultiBulkSlots(client * c) { |
| 4387 | /* Format: 1) 1) start slot |
no test coverage detected