doc: documented the 0-delay timer workaround for contexts where cosockets are not available (yet). also documented the "connection in dubious state" error message for tcpsock:setkeepalive().

This commit is contained in:
Yichun Zhang (agentzh) 2014-11-03 11:37:04 -08:00
Родитель 20bbbfbe44
Коммит 60c64cc144
2 изменённых файлов: 8 добавлений и 0 удалений

Просмотреть файл

@ -743,6 +743,8 @@ Due the internal limitations in the nginx core, the cosocket API are disabled in
The cosockets are currently also disabled in the [init_by_lua*](#init_by_lua) and [init_worker_by_lua*](#init_worker_by_lua) directive contexts but we may add support for these contexts in the future because there is no limitation in the nginx core (or the limitation might be worked around).
There exists a work-around, however, when the original context does *not* need to wait for the cosocket results. That is, creating a 0-delay timer via the [ngx.timer.at](#ngxtimerat) API and do the cosocket results in the timer handler, which runs asynchronously as to the original context creating the timer.
[Back to TOC](#table-of-contents)
Special PCRE Sequences
@ -6170,6 +6172,8 @@ Idle connections in the pool will be monitored for any exceptional events like c
In case of success, this method returns `1`; otherwise, it returns `nil` and a string describing the error.
When the system receive buffer for the current connection has unread data, then this method will return the "connection in dubious state" error message (as the second return value) because the previous session has unread data left behind for the next session and the connection is not safe to be reused.
This method also makes the current cosocket object enter the "closed" state, so there is no need to manually call the [close](#tcpsockclose) method on it afterwards.
This feature was first introduced in the `v0.5.0rc1` release.

Просмотреть файл

@ -605,6 +605,8 @@ Due the internal limitations in the nginx core, the cosocket API are disabled in
The cosockets are currently also disabled in the [[#init_by_lua|init_by_lua*]] and [[#init_worker_by_lua|init_worker_by_lua*]] directive contexts but we may add support for these contexts in the future because there is no limitation in the nginx core (or the limitation might be worked around).
There exists a work-around, however, when the original context does *not* need to wait for the cosocket results. That is, creating a 0-delay timer via the [[#ngx.timer.at|ngx.timer.at]] API and do the cosocket results in the timer handler, which runs asynchronously as to the original context creating the timer.
== Special PCRE Sequences ==
PCRE sequences such as <code>\d</code>, <code>\s</code>, or <code>\w</code>, require special attention because in string literals, the backslash character, <code>\</code>, is stripped out by both the Lua language parser and by the Nginx config file parser before processing. So the following snippet will not work as expected:
@ -5188,6 +5190,8 @@ Idle connections in the pool will be monitored for any exceptional events like c
In case of success, this method returns <code>1</code>; otherwise, it returns <code>nil</code> and a string describing the error.
When the system receive buffer for the current connection has unread data, then this method will return the "connection in dubious state" error message (as the second return value) because the previous session has unread data left behind for the next session and the connection is not safe to be reused.
This method also makes the current cosocket object enter the "closed" state, so there is no need to manually call the [[#tcpsock:close|close]] method on it afterwards.
This feature was first introduced in the <code>v0.5.0rc1</code> release.