summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_unit.h
diff options
context:
space:
mode:
authorMax Romanov <max.romanov@nginx.com>2020-10-28 00:01:46 +0300
committerMax Romanov <max.romanov@nginx.com>2020-10-28 00:01:46 +0300
commit4cb8aeb31a8cf47f6c61aaccb95bbbf47cbc2393 (patch)
tree381eed08e9d478216eed51ea0301dae63b7dc4da /src/nxt_unit.h
parent131b6a7ffab7b3303a00a50f5cf764dc99e23cc0 (diff)
downloadunit-4cb8aeb31a8cf47f6c61aaccb95bbbf47cbc2393.tar.gz
unit-4cb8aeb31a8cf47f6c61aaccb95bbbf47cbc2393.tar.bz2
Router: introducing the PORT_ACK message.
The PORT_ACK message is the router's response to the application's NEW_PORT message. After receiving PORT_ACK, the application is safe to process requests using this port. This message avoids a racing condition when the application starts processing a request from the shared queue and sends REQ_HEADERS_ACK. The REQ_HEADERS_ACK message contains the application port ID as reply_port, which the router uses to send request data. When the application creates a new port, it immediately sends it to the main router thread. Because the request is processed outside the main thread, a racing condition can occur between the receipt of the new port in the main thread and the receipt of REQ_HEADERS_ACK in the worker router thread where the same port is specified as reply_port.
Diffstat (limited to 'src/nxt_unit.h')
-rw-r--r--src/nxt_unit.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/nxt_unit.h b/src/nxt_unit.h
index 303d5aa1..cb78e862 100644
--- a/src/nxt_unit.h
+++ b/src/nxt_unit.h
@@ -154,6 +154,8 @@ struct nxt_unit_callbacks_s {
/* Receive data on port id. Optional. */
ssize_t (*port_recv)(nxt_unit_ctx_t *, nxt_unit_port_t *port,
void *buf, size_t buf_size, void *oob, size_t oob_size);
+
+ int (*ready_handler)(nxt_unit_ctx_t *);
};