export-libwebsocket_service_fd-api.patch
Signed-off-by: Andy Green <andy.green@linaro.org>
diff --git a/lib/libwebsockets.c b/lib/libwebsockets.c
index 586d603..83505c8 100644
--- a/lib/libwebsockets.c
+++ b/lib/libwebsockets.c
@@ -133,7 +133,19 @@
free(wsi);
}
-static int
+
+/**
+ * libwebsocket_service_fd() - Service polled socket with something waiting
+ * @this: Websocket context
+ * @pollfd: The pollfd entry describing the socket fd and which events
+ * happened.
+ *
+ * This function closes any active connections and then frees the
+ * context. After calling this, any further use of the context is
+ * undefined.
+ */
+
+int
libwebsocket_service_fd(struct libwebsocket_context *this,
struct pollfd *pollfd)
{
diff --git a/lib/libwebsockets.h b/lib/libwebsockets.h
index 0549a50..d15c2c7 100644
--- a/lib/libwebsockets.h
+++ b/lib/libwebsockets.h
@@ -22,6 +22,8 @@
#ifndef __LIBWEBSOCKET_H__
#define __LIBWEBSOCKET_H__
+#include <poll.h>
+
#define CONTEXT_PORT_NO_LISTEN 0
@@ -191,6 +193,10 @@
extern int
libwebsocket_service(struct libwebsocket_context *this, int timeout_ms);
+extern int
+libwebsocket_service_fd(struct libwebsocket_context *this,
+ struct pollfd *pollfd);
+
/*
* IMPORTANT NOTICE!
*
diff --git a/libwebsockets-api-doc.html b/libwebsockets-api-doc.html
index 2184f16..9e5f27e 100644
--- a/libwebsockets-api-doc.html
+++ b/libwebsockets-api-doc.html
@@ -1,3 +1,23 @@
+<h2>libwebsocket_service_fd - Service polled socket with something waiting</h2>
+<i>int</i>
+<b>libwebsocket_service_fd</b>
+(<i>struct libwebsocket_context *</i> <b>this</b>,
+<i>struct pollfd *</i> <b>pollfd</b>)
+<h3>Arguments</h3>
+<dl>
+<dt><b>this</b>
+<dd>Websocket context
+<dt><b>pollfd</b>
+<dd>The pollfd entry describing the socket fd and which events
+happened.
+</dl>
+<h3>Description</h3>
+<blockquote>
+This function closes any active connections and then frees the
+context. After calling this, any further use of the context is
+undefined.
+</blockquote>
+<hr>
<h2>libwebsocket_context_destroy - Destroy the websocket context</h2>
<i>void</i>
<b>libwebsocket_context_destroy</b>