buffer_event learned get_read/get_write buffer accessors
[luaevent.git] / doc / modules / luaevent.core.bufferevent.mdwn
bloba2deee2dc3912b7ac89459488a75e2b69cb510f4
1 ----
2 Functions:
4 [[toc levels=1]]
6 ## Read/Write/Error Callback:
7 * Input: `(bufferevent, what)`
8         * `bufferevent` - Reference to the bufferevent that raised the callback
9         * `what` - What happened:
10                 * == `EVBUFFER_READ` - Buffer contains at least low-watermark length and no more than high-watermark length
11                 * == `EVBUFFER_WRITE` - Buffer ready to write to
12                 * (other) - Error condition
13                         * May be or-ed/added with `EVBUFFER_READ`/`EVBUFFER_WRITE` to specify where it happened
14                         * `EVBUFFER_ERROR` - Marks error condition (need to look at 'errno' for error.. not exposed yet)
15                         * `EVBUFFER_TIMEOUT` - Marks activity timeout
16                         * `EVBUFFER_EOF` - Marks disconnection/end-of-file condition
18 ## bufferevent.new
19 * Input: `(fd, read, write, error)`
20         * `fd` - File descriptor to watch
21         * `read` - (may be nil) - callback to call when data in buffer is above the low watermark
22         * `write` - (may be nil) - callback to call when the output buffer contains less data than the low watermark
23         * `error` - callback to call when there is an erroneous condition
25 ## bufferevent (__gc)
26 * Releases the bufferevent
27         * Disconnects event buffers since they were owned by the bufferevent object in 'C' land
28         * Disconnects all references so that any erroneous callbacks don't cause failures