summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_port_memory_int.h (follow)
AgeCommit message (Collapse)AuthorFilesLines
2019-12-24Introducing port messages to notify about out of shared memory.Max Romanov1-0/+1
- OOSM (out of shared memory). Sent by application process to router when application reaches the limit of allocated shared memory and needs more. - SHM_ACK. Sent by router to application when the application's shared memory is released and the OOSM flag is enabled for the segment. This implements blocking mode (the library waits for SHM_ACK in case of out of shared memory condition and retries allocating the required memory amount) and non-blocking mode (the library notifies the application that it's out of shared memory and returns control to the application module that sets up the output queue and puts SHM_ACK in the main message loop).
2018-07-12Enabled body buffer shared memory segmentation.Max Romanov1-2/+2
Changeset #699 fixes shared memory allocation: continous buffer with requested size should be allocated or function failed. For body longer than 10 Mb, this allocation will definitely fails. For body buffer it is not required to send it in a single continous buffer, so, need to request minimum reasonable amount of shared memory and try to extend it, if possible or allocate next buffer.
2018-06-20Fixed allocation of multiple shared memory chunks.Max Romanov1-4/+11
Previously, one shared memory chunk was allocated under mutex and other chunks (if required) were allocated using atomic operations. So such allocation is not guaranteed and the result buffer can be less than requested. This commit moves multiple chunks allocation under mutex and guarantees the result buffer is large enough.
2017-12-27Implementing the ability to cancel request before worker starts processing it.Max Romanov1-18/+26
2017-10-19Introducing mmap_handler to count references to shared memory.Max Romanov1-1/+6
"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-19Introducing src_pid for mmap header for accurate buf completion.Max Romanov1-1/+2
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-09-18Fixing shared memory thread safety issue.Max Romanov1-0/+1
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-06-23Store pointer to shared memory start in buf->parent.Max Romanov1-0/+179
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.