bufferevent learned (get|set)_timeouts
[luaevent.git] / doc / modules / luaevent.core.bufferevent.mdwn
blobd63f4fbeda0100575889212bff24794b6f7b40cb
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
30 ## bufferevent:get_read
31 * Obtains the input buffer associated w/ the bufferevent
33 ## bufferevent:get_write
34 * Obtains the output buffer associated w/ the bufferevent
36 ## bufferevent:set_read_watermarks
37 * Input: `(low, high)`
38         * `low` - Size of buffer at which an event would be fired
39         * `high` - Maximum size of buffer to read to
41 ## bufferevent:set_write_watermarks
42 * Input: `(low, high)`
43         * `low` - When buffer is below this, the event will be fired
44         * `high` - N/A to libevent, user app may use this
46 ## bufferevent:get_read_watermarks
47 * Output: `low, high`
48 * See `set_read_watermarks`
50 ## bufferevent:get_write_watermarks
51 * Output: `low, high`
52 * See `set_write_watermarks`
54 ## bufferevent:set_timeouts
55 * Sets timeouts for the bufferevent's events
56 * Input: `(read, write)`
57         * `read` - Read readiness timeout
58         * `write` - Write readiness timeout
60 ## bufferevent:get_timeouts
61 * Output: `read, write`
62 * See `set_timeouts`