libwebsocket_callback_all_protocol
Signed-off-by: Andy Green <andy.green@linaro.org>
This commit is contained in:
parent
890f8e992b
commit
e39e6ef926
2 changed files with 32 additions and 0 deletions
|
@ -1567,6 +1567,34 @@ libwebsocket_callback_on_writable_all_protocol(
|
|||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* libwebsocket_callback_all_protocol() - Callback all connections using
|
||||
* the given protocol with the given reason
|
||||
*
|
||||
* @protocol: Protocol whose connections will get callbacks
|
||||
* @reason: Callback reason index
|
||||
*/
|
||||
|
||||
LWS_VISIBLE int
|
||||
libwebsocket_callback_all_protocol(
|
||||
const struct libwebsocket_protocols *protocol, int reason)
|
||||
{
|
||||
struct libwebsocket_context *context = protocol->owning_server;
|
||||
int n;
|
||||
struct libwebsocket *wsi;
|
||||
|
||||
for (n = 0; n < context->fds_count; n++) {
|
||||
wsi = context->lws_lookup[context->fds[n].fd];
|
||||
if (!wsi)
|
||||
continue;
|
||||
if (wsi->protocol == protocol)
|
||||
protocol->callback(context, wsi,
|
||||
reason, wsi->user_space, NULL, 0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* libwebsocket_set_timeout() - marks the wsi as subject to a timeout
|
||||
*
|
||||
|
|
|
@ -1042,6 +1042,10 @@ LWS_VISIBLE LWS_EXTERN int
|
|||
libwebsocket_callback_on_writable_all_protocol(
|
||||
const struct libwebsocket_protocols *protocol);
|
||||
|
||||
LWS_VISIBLE LWS_EXTERN int
|
||||
libwebsocket_callback_all_protocol(
|
||||
const struct libwebsocket_protocols *protocol, int reason);
|
||||
|
||||
LWS_VISIBLE LWS_EXTERN int
|
||||
libwebsocket_get_socket_fd(struct libwebsocket *wsi);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue