diff --git a/README.markdown b/README.markdown
index 29661358..6f5f5350 100644
--- a/README.markdown
+++ b/README.markdown
@@ -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.
diff --git a/doc/HttpLuaModule.wiki b/doc/HttpLuaModule.wiki
index 0ce9cc88..8ba3f1cc 100644
--- a/doc/HttpLuaModule.wiki
+++ b/doc/HttpLuaModule.wiki
@@ -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 \d
, \s
, or \w
, require special attention because in string literals, the backslash character, \
, 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 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 [[#tcpsock:close|close]] method on it afterwards.
This feature was first introduced in the v0.5.0rc1
release.