Max Romanov
5a43bd0bfd
PHP app request processing.
2017-06-23 19:20:08 +03:00
Max Romanov
fa6582d9ad
Python app request processing.
2017-06-23 19:20:08 +03:00
Max Romanov
e7a0634a71
Application-side message processing.
...
Usage on the router side:
nxt_app_wmsg_t wmsg;
nxt_app_parse_ctx_t parse_ctx;
nxt_app_http_req_init(task, &parse_ctx);
/* parse incoming request data */
if (nxt_app_http_req_parse(task, &parse_ctx, buf) == NXT_DONE) {
/* choose app */
nxt_app = nxt_select_app(... &parse_ctx.r ...);
/* find port */
wmsg.port = nxt_get_app_port(... nxt_app ...);
wmsg.buf = &wmsg.write;
/* fill write message buffer in shared mem */
nxt_app->prepare_msg(task, &parse_ctx.r, &wmsg);
/* send message to app for processing */
nxt_port_socket_write(task, wmsg.port, NXT_PORT_MSG_DATA,
-1, 0, 0, wmsg.write);
}
2017-06-23 19:20:08 +03:00
Max Romanov
3b9aa27625
Added mem_pool pointer member to nxt_port_send_msg_t.
...
To decouple nxt_port_send_msg_t from port.
2017-06-23 19:20:08 +03:00
Max Romanov
eaf28db46e
Moved message size to nxt_port_recv_msg_t for convenience.
2017-06-23 19:20:08 +03:00
Max Romanov
3e989a165c
Extruded nxt_port_send_port() to send port to one process.
2017-06-23 19:20:08 +03:00
Max Romanov
0cd9521687
Store pointer to shared memory start in buf->parent.
...
nxt_port_mmap_t stored in arrays and it is unsafe to store
pointer to array element.
Shared memory structures and macros moved to separate header
file to be used by GO package.
2017-06-23 19:20:04 +03:00
Max Romanov
b13cdb0faa
Store mem_pool in buf->data instead of port for consistency.
2017-06-23 19:19:41 +03:00
Max Romanov
ac43bfcc72
nxt_process_create() changed to add process to runtime before callbacks.
2017-06-23 19:19:41 +03:00
Max Romanov
e5fe254e1e
nxt_port_create() use task instead of thread.
...
Write socket close() call moved out from nxt_port_create().
2017-06-23 19:19:41 +03:00
Max Romanov
89ab9a9d05
Shorter shared memory name generated.
2017-06-23 19:19:41 +03:00
Max Romanov
0fdcdde6c8
lvlhash for ports moved to separate files for future re-use.
2017-06-23 19:19:41 +03:00
Max Romanov
58e20da984
Runtime ports fix, add enumeration macros.
2017-06-23 19:19:41 +03:00
Max Romanov
952ec2e0ff
Fixed building test on Solaris
2017-05-12 20:41:34 +03:00
Max Romanov
f7b4bdfd89
Using shared memory to send data via nxt_port.
...
Usage:
b = nxt_port_mmap_get_buf(task, port, size);
b->mem.free = nxt_cpymem(b->mem.free, data, size);
nxt_port_socket_write(task, port, NXT_PORT_MSG_DATA, -1, 0, b);
2017-05-12 20:32:41 +03:00
Max Romanov
cfed068c1d
Macros for atomic 'OR' and 'AND' operations introduced.
...
Compiler built-ins used, where possible. Necessary configure checks added.
New macros:
nxt_atomic_or_fetch(ptr, val)
nxt_atomic_and_fetch(ptr, val)
Syntax and behaviour is similar to __sync_or_and_fetch and __sync_and_and_fetch
GCC build-ins.
2017-04-21 16:55:13 +03:00