Commit cd55c624 authored by sigiesec's avatar sigiesec

Problem: use of unqualified "id" in code example

Solution: use "routing_id" instead
parent 0874eec8
...@@ -559,16 +559,16 @@ void *socket = zmq_socket (ctx, ZMQ_STREAM); ...@@ -559,16 +559,16 @@ void *socket = zmq_socket (ctx, ZMQ_STREAM);
assert (socket); assert (socket);
int rc = zmq_bind (socket, "tcp://*:8080"); int rc = zmq_bind (socket, "tcp://*:8080");
assert (rc == 0); assert (rc == 0);
/* Data structure to hold the ZMQ_STREAM ID */ /* Data structure to hold the ZMQ_STREAM routing id */
uint8_t id [256]; uint8_t routing_id [256];
size_t id_size = 256; size_t routing_id_size = 256;
/* Data structure to hold the ZMQ_STREAM received data */ /* Data structure to hold the ZMQ_STREAM received data */
uint8_t raw [256]; uint8_t raw [256];
size_t raw_size = 256; size_t raw_size = 256;
while (1) { while (1) {
/* Get HTTP request; ID frame and then request */ /* Get HTTP request; routing id frame and then request */
id_size = zmq_recv (socket, id, 256, 0); routing_id_size = zmq_recv (socket, routing_id, 256, 0);
assert (id_size > 0); assert (routing_id_size > 0);
do { do {
raw_size = zmq_recv (socket, raw, 256, 0); raw_size = zmq_recv (socket, raw, 256, 0);
assert (raw_size >= 0); assert (raw_size >= 0);
...@@ -579,11 +579,11 @@ while (1) { ...@@ -579,11 +579,11 @@ while (1) {
"Content-Type: text/plain\r\n" "Content-Type: text/plain\r\n"
"\r\n" "\r\n"
"Hello, World!"; "Hello, World!";
/* Sends the ID frame followed by the response */ /* Sends the routing id frame followed by the response */
zmq_send (socket, id, id_size, ZMQ_SNDMORE); zmq_send (socket, routing_id, routing_id_size, ZMQ_SNDMORE);
zmq_send (socket, http_response, strlen (http_response), 0); zmq_send (socket, http_response, strlen (http_response), 0);
/* Closes the connection by sending the ID frame followed by a zero response */ /* Closes the connection by sending the routing id frame followed by a zero response */
zmq_send (socket, id, id_size, ZMQ_SNDMORE); zmq_send (socket, routing_id, routing_id_size, ZMQ_SNDMORE);
zmq_send (socket, 0, 0, 0); zmq_send (socket, 0, 0, 0);
} }
zmq_close (socket); zmq_close (socket);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment