From 9f99034f7ef4dc738bfb039b581c595db7f5b2f4 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Sat, 12 Feb 2011 11:57:45 +0000 Subject: [PATCH] export-libwebsocket_service_fd-api.patch Signed-off-by: Andy Green --- lib/libwebsockets.c | 14 +++++++++++++- lib/libwebsockets.h | 6 ++++++ libwebsockets-api-doc.html | 20 ++++++++++++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) 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 @@ libwebsocket_close_and_free_session(struct libwebsocket *wsi) 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 + #define CONTEXT_PORT_NO_LISTEN 0 @@ -191,6 +193,10 @@ libwebsockets_fork_service_loop(struct libwebsocket_context *this); 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 @@ +

libwebsocket_service_fd - Service polled socket with something waiting

+int +libwebsocket_service_fd +(struct libwebsocket_context * this, +struct pollfd * pollfd) +

Arguments

+
+
this +
Websocket context +
pollfd +
The pollfd entry describing the socket fd and which events +happened. +
+

Description

+
+This function closes any active connections and then frees the +context. After calling this, any further use of the context is +undefined. +
+

libwebsocket_context_destroy - Destroy the websocket context

void libwebsocket_context_destroy -- 2.7.4