summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_port_memory.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2018-01-24Fixed formatting in nxt_sprintf() and logging.Sergey Kandaurov1-5/+5
2018-01-11Fixed DragonFly BSD shared memory implementation.Igor Sysoev1-1/+1
2017-12-28Changed nxt_mp_retain() and nxt_mp_release() interfaces.Igor Sysoev1-2/+6
2017-12-27Implementing the ability to cancel request before worker starts processing it.Max Romanov1-36/+175
2017-11-20Fixing Coverity warnings.Max Romanov1-1/+2
CID 200496 CID 200494 CID 200490 CID 200489 CID 200483 CID 200482 CID 200472 CID 200465
2017-10-25Avoiding compilation on systems with no working shared memory.Valentin Bartenev1-0/+4
2017-10-19Introducing mmap_handler to count references to shared memory.Max Romanov1-84/+137
"All problems in computer science can be solved by another level of indirection" Butler Lampson Completion handlers for application response buffers executed after sending the data to client. Application worker can be stopped right after send response buffers to router. Worker stop causes removal of all data structures for the worker. To prevent shared memory segment unmap, need to count the number of buffers which uses it. So instead of direct reference to shared memory, need to reference to intermediate 'handler' structure with use counter and pointer to shared memory.
2017-10-19Supporting concurrent shared memory fd receive in router.Max Romanov1-86/+64
Two different router threads may send different requests to single application worker. In this case shared memory fds from worker to router will be send over 2 different router ports. These fds will be received and processed by different threads in any order. This patch made possible to add incoming shared memory segments in arbitrary order. Additionally, array and memory pool are no longer used to store segments because of pool's single threaded nature. Custom array-like structure nxt_port_mmaps_t introduced.
2017-10-19Introducing src_pid for mmap header for accurate buf completion.Max Romanov1-13/+25
This allows to use shared memory to communicate with main process. This patch changes shared memory segment format and breaks compatibility with older modules.
2017-10-04Using engine memiory pool for port write allocations.Max Romanov1-2/+2
To allow use port from different threads, the first step is to avoid using port's memory pool for temporary allocations required to send data through the port. Including but not limited by: - buffers for data; - send message structures; - new mmap fd notifications; It is still safe to use port memory pool for incoming buffers allocations because recieve operation bound to single thread.
2017-09-18Fixing shared memory thread safety issue.Max Romanov1-1/+6
Do not reuse shared memory segment with different port until this segment successfully received and indexed on other side. However, segment can be used to transfer data via the port it was sent at any time.
2017-09-06Style fixes.Igor Sysoev1-11/+17
2017-08-31nginext has been renamed to unit.Igor Sysoev1-1/+1
2017-08-11Request body read state implemented.Max Romanov1-12/+22
With specific timeout and buffer size settings.
2017-08-02Added basic port error handler.Max Romanov1-11/+3
2017-08-02Runtime processes protected with mutex.Max Romanov1-1/+1
2017-08-02Freed mmap memory filled with 0xA5.Max Romanov1-0/+6
2017-08-02Added bit flags to type parameter of nxt_port_socket_write().Max Romanov1-41/+1
NXT_PORT_MSG_LAST - mark message as last; NXT_PORT_MSG_CLOSE_FD - close fd right after send; Type constants altered to include last flag for single buffer messages. Last sign is critical for coming port RPC layer. Handlers unregistered on last message. Create sync buffer is not convenient, extra parameter is better.
2017-07-12New process port exchange changed. READY message type introduced.Max Romanov1-12/+56
Application process start request DATA message from router to master. Master notifies router via NEW_PORT message after worker process become ready.
2017-07-10Introducing thread-safe nxt_random().Igor Sysoev1-1/+1
2017-07-07Memory pool thread safety checks in DEBUG build and usage fixes.Max Romanov1-2/+8
2017-07-07Redirecting buffer completion handler to specific engine.Max Romanov1-13/+16
There is a case in router where we use port in router connection thread. Buffers are allocated within connection memory pool which can be used only in this router thread. sendmsg() can be postponed into main router thread and completion handler will compare current engine and post itself to correct engine.
2017-06-23Incoming and outgoing port_mmap arrays are protected with mutexes.Max Romanov1-0/+12
2017-06-23Moved message size to nxt_port_recv_msg_t for convenience.Max Romanov1-1/+3
2017-06-23Store pointer to shared memory start in buf->parent.Max Romanov1-231/+202
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-23Store mem_pool in buf->data instead of port for consistency.Max Romanov1-13/+33
2017-06-23Shorter shared memory name generated.Max Romanov1-2/+2
2017-06-20Using new memory pool implementation.Igor Sysoev1-3/+3
2017-05-12Using shared memory to send data via nxt_port.Max Romanov1-0/+700
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);