40
40
/*
41
41
* Mostly opaque structure with library state.
42
42
*
43
- * Only user defined 'data' pointer exposed here. The rest is unit
43
+ * Only the user defined 'data' pointer is exposed here. The rest is unit
44
44
* implementation specific and hidden.
45
45
*/
46
46
struct nxt_unit_s {
@@ -51,8 +51,8 @@ struct nxt_unit_s {
51
51
* Thread context.
52
52
*
53
53
* First (main) context is provided 'for free'. To receive and process
54
- * requests in other thread , one need to allocate context and use it
55
- * further in this thread.
54
+ * requests in other threads , one needs to allocate a new context and use it
55
+ * further in that thread.
56
56
*/
57
57
struct nxt_unit_ctx_s {
58
58
void * data ; /* User context-specific data. */
@@ -72,7 +72,7 @@ struct nxt_unit_port_id_s {
72
72
};
73
73
74
74
/*
75
- * unit provides port storage which is able to store and find the following
75
+ * Unit provides port storage which is able to store and find the following
76
76
* data structures.
77
77
*/
78
78
struct nxt_unit_port_s {
@@ -114,13 +114,13 @@ struct nxt_unit_request_info_s {
114
114
115
115
116
116
/*
117
- * Set of application-specific callbacks. Application may leave all optional
118
- * callbacks as NULL.
117
+ * Set of application-specific callbacks. The application may leave all
118
+ * optional callbacks as NULL.
119
119
*/
120
120
struct nxt_unit_callbacks_s {
121
121
/*
122
- * Process request. Unlike all other callback , this callback
123
- * need to be defined by application.
122
+ * Process request. Unlike all other callbacks , this callback is required
123
+ * and needs to be defined by the application.
124
124
*/
125
125
void (* request_handler )(nxt_unit_request_info_t * req );
126
126
@@ -201,15 +201,15 @@ struct nxt_unit_read_info_s {
201
201
nxt_unit_ctx_t * nxt_unit_init (nxt_unit_init_t * );
202
202
203
203
/*
204
- * Main function useful in case when application does not have it's own
205
- * event loop. nxt_unit_run() starts infinite message wait and process loop.
204
+ * Main function, useful in case the application does not have its own event
205
+ * loop. nxt_unit_run() starts an infinite message wait and process loop.
206
206
*
207
207
* for (;;) {
208
208
* app_lib->port_recv(...);
209
209
* nxt_unit_process_msg(...);
210
210
* }
211
211
*
212
- * The normally function returns when QUIT message received from Unit.
212
+ * The function returns normally when a QUIT message is received from Unit.
213
213
*/
214
214
int nxt_unit_run (nxt_unit_ctx_t * );
215
215
@@ -220,10 +220,10 @@ int nxt_unit_run_shared(nxt_unit_ctx_t *ctx);
220
220
nxt_unit_request_info_t * nxt_unit_dequeue_request (nxt_unit_ctx_t * ctx );
221
221
222
222
/*
223
- * Receive and process one message, invoke configured callbacks.
223
+ * Receive and process one message, and invoke configured callbacks.
224
224
*
225
- * If application implements it's own event loop, each datagram received
226
- * from port socket should be initially processed by unit. This function
225
+ * If the application implements its own event loop, each datagram received
226
+ * from the port socket should be initially processed by unit. This function
227
227
* may invoke other application-defined callback for message processing.
228
228
*/
229
229
int nxt_unit_run_once (nxt_unit_ctx_t * ctx );
@@ -234,8 +234,8 @@ int nxt_unit_process_port_msg(nxt_unit_ctx_t *ctx, nxt_unit_port_t *port);
234
234
void nxt_unit_done (nxt_unit_ctx_t * );
235
235
236
236
/*
237
- * Allocate and initialize new execution context with new listen port to
238
- * process requests in other thread.
237
+ * Allocate and initialize a new execution context with a new listen port to
238
+ * process requests in another thread.
239
239
*/
240
240
nxt_unit_ctx_t * nxt_unit_ctx_alloc (nxt_unit_ctx_t * , void * );
241
241
@@ -253,7 +253,7 @@ void nxt_unit_split_host(char *host_start, uint32_t host_length,
253
253
void nxt_unit_request_group_dup_fields (nxt_unit_request_info_t * req );
254
254
255
255
/*
256
- * Allocate response structure capable to store limited numer of fields.
256
+ * Allocate response structure capable of storing a limited number of fields.
257
257
* The structure may be accessed directly via req->response pointer or
258
258
* filled step-by-step using functions add_field and add_content.
259
259
*/
@@ -273,8 +273,8 @@ int nxt_unit_response_add_content(nxt_unit_request_info_t *req,
273
273
const void * src , uint32_t size );
274
274
275
275
/*
276
- * Send prepared response to Unit server. Response structure destroyed during
277
- * this call.
276
+ * Send the prepared response to the Unit server. The Response structure is
277
+ * destroyed during this call.
278
278
*/
279
279
int nxt_unit_response_send (nxt_unit_request_info_t * req );
280
280
0 commit comments