decouple-service-from-fd-array-index.patch

This patch removes the relationship between position in the
pollfd[] array and any meaning about the type of socket.

It also refactors the service loop so there is a per-fd
function that detects the mode of the connection and services
it accordingly.

The context wsi * array is removed and a hashtable introduced
allowing fast wsi lookup from just the fd that it is
associated with

Signed-off-by: Andy Green <andy@warmcat.com>
diff --git a/libwebsockets-api-doc.html b/libwebsockets-api-doc.html
index 422ed7c..2184f16 100644
--- a/libwebsockets-api-doc.html
+++ b/libwebsockets-api-doc.html
@@ -67,6 +67,13 @@
 <dt><b>wsi</b>
 <dd>Websocket connection instance to get callback for
 </dl>
+<h3>Description</h3>
+<blockquote>
+<p>
+This only works for internal <b>poll</b> management, (ie, calling the libwebsocket
+service loop, you will have to make your own arrangements if your <b>poll</b>
+loop is managed externally.
+</blockquote>
 <hr>
 <h2>libwebsocket_callback_on_writable_all_protocol - Request a callback for all connections using the given protocol when it becomes possible to write to each socket without blocking in turn.</h2>
 <i>int</i>
@@ -77,6 +84,13 @@
 <dt><b>protocol</b>
 <dd>Protocol whose connections will get callbacks
 </dl>
+<h3>Description</h3>
+<blockquote>
+<p>
+This only works for internal <b>poll</b> management, (ie, calling the libwebsocket
+service loop, you will have to make your own arrangements if your <b>poll</b>
+loop is managed externally.
+</blockquote>
 <hr>
 <h2>libwebsocket_get_socket_fd - returns the socket file descriptor</h2>
 <i>int</i>
@@ -110,6 +124,10 @@
 <p>
 If the output side of a server process becomes choked, this allows flow
 control for the input side.
+<p>
+This only works for internal <b>poll</b> management, (ie, calling the libwebsocket
+service loop, you will have to make your own arrangements if your <b>poll</b>
+loop is managed externally.
 </blockquote>
 <hr>
 <h2>libwebsocket_canonical_hostname - returns this host's hostname</h2>