From 60674c11c9ad1065ce975ff8684912ed9f9aa049 Mon Sep 17 00:00:00 2001 From: Sergey Lyubka Date: Thu, 13 Mar 2014 12:23:53 +0000 Subject: [PATCH] API docs regarding MG_POLL changed --- docs/API.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/API.md b/docs/API.md index 01eac164..0a40ee39 100644 --- a/docs/API.md +++ b/docs/API.md @@ -71,16 +71,16 @@ occur. Sequence of events for the accepted connection is this: certain prefix, and let Mongoose serve all static files. If event handler decides to serve the request, but doesn't have all the data at the moment, it should return `MG_MORE`. That tells - Mongoose to send `MG_POLL` events on each iteration of `mg_poll_server()` + Mongoose to keep the connection open after callback returns. `mg_connection::connection_param` pointer is a placeholder to keep user-specific data. For example, handler could decide to open a DB connection and store DB connection handle in `connection_param`. - * `MG_POLL` is sent only to those connections which returned `MG_MORE`. - Event handler should try to complete the reply. If reply is completed, - then event handler should return `MG_TRUE`. Otherwise, it should - return `MG_FALSE`, and polling will continue until - handler returns `MG_TRUE`. + * `MG_POLL` is sent to every connection on every iteration of + `mg_poll_server()`. Event handler should return `MG_FALSE` to ignore + this event. If event handler returns `MG_TRUE`, then Mongoose assumes + that event handler has finished sending data, and Mongoose will + close the connection. * `MG_HTTP_ERROR` sent when Mongoose is about to send HTTP error back to the client. Event handler can choose to send a reply itself, in which case event handler must return `MG_TRUE`. Otherwise, event handler must