From f7ee549a58628b1e750b61f869082ae41728ab80 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Sun, 13 Feb 2011 09:04:21 +0000 Subject: [PATCH] introduce-libwebsockets_hangup_on_client.patch Signed-off-by: Andy Green --- lib/libwebsockets.c | 19 +++++++++++++++++++ lib/libwebsockets.h | 3 +++ libwebsockets-api-doc.html | 13 +++++++++++++ 3 files changed, 35 insertions(+) diff --git a/lib/libwebsockets.c b/lib/libwebsockets.c index 59c954a8..e55da35d 100644 --- a/lib/libwebsockets.c +++ b/lib/libwebsockets.c @@ -133,6 +133,25 @@ libwebsocket_close_and_free_session(struct libwebsocket *wsi) free(wsi); } +/** + * libwebsockets_hangup_on_client() - Server calls to terminate client + * connection + * @this: libwebsockets context + * @fd: Connection socket descriptor + */ + +void +libwebsockets_hangup_on_client(struct libwebsocket_context *this, int fd) +{ + struct libwebsocket *wsi = wsi_from_fd(this, fd); + + if (wsi == NULL) + return; + + libwebsocket_close_and_free_session(wsi); +} + + /** * libwebsockets_get_peer_addresses() - Get client address information * @fd: Connection socket descriptor diff --git a/lib/libwebsockets.h b/lib/libwebsockets.h index 31f28e95..f227073b 100644 --- a/lib/libwebsockets.h +++ b/lib/libwebsockets.h @@ -388,4 +388,7 @@ extern void libwebsockets_get_peer_addresses(int fd, char *name, int name_len, char *rip, int rip_len); +extern void +libwebsockets_hangup_on_client(struct libwebsocket_context *this, int fd); + #endif diff --git a/libwebsockets-api-doc.html b/libwebsockets-api-doc.html index 487b942b..1415ff5e 100644 --- a/libwebsockets-api-doc.html +++ b/libwebsockets-api-doc.html @@ -1,3 +1,16 @@ +

libwebsockets_hangup_on_client - Server calls to terminate client connection

+void +libwebsockets_hangup_on_client +(struct libwebsocket_context * this, +int fd) +

Arguments

+
+
this +
libwebsockets context +
fd +
Connection socket descriptor +
+

libwebsockets_get_peer_addresses - Get client address information

void libwebsockets_get_peer_addresses