mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
add separate server writeable and change naming to match rest of callbacks
Notice that the naming is changed, the notification to a server that it can write to the client is now called LWS_CALLBACK_SERVER_WRITEABLE, and the notification to a client that it can write to a server is LWS_CALLBACK_CLIENT_WRITEABLE. Signed-off-by: Andy Green <andy@warmcat.com>
This commit is contained in:
parent
58eaa74fd0
commit
9e4c2b6e35
5 changed files with 18 additions and 12 deletions
|
@ -229,7 +229,7 @@ dist_libwebsockets_la_SOURCES = libwebsockets.c handshake.c parsers.c \
|
|||
libwebsockets_la_CFLAGS := -rdynamic -fPIC -Wall -Werror -std=gnu99 -pedantic -c \
|
||||
-DDATADIR=\"@datadir@\" -DLWS_OPENSSL_CLIENT_CERTS=\"@clientcertdir@\"
|
||||
|
||||
libwebsockets_la_LDFLAGS = -version-info 0:3
|
||||
libwebsockets_la_LDFLAGS = -lz -version-info 0:3
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
|
|
|
@ -582,10 +582,12 @@ user_service:
|
|||
LWS_CALLBACK_CLEAR_MODE_POLL_FD,
|
||||
(void *)(long)wsi->sock, NULL, POLLOUT);
|
||||
|
||||
wsi->protocol->callback(context, wsi,
|
||||
LWS_CALLBACK_CLIENT_WRITEABLE,
|
||||
wsi->user_space,
|
||||
NULL, 0);
|
||||
if (wsi->mode == LWS_CONNMODE_WS_CLIENT)
|
||||
n = LWS_CALLBACK_CLIENT_WRITEABLE;
|
||||
else
|
||||
n = LWS_CALLBACK_SERVER_WRITEABLE;
|
||||
|
||||
wsi->protocol->callback(context, wsi, n, wsi->user_space, NULL, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -55,6 +55,7 @@ enum libwebsocket_callback_reasons {
|
|||
LWS_CALLBACK_CLIENT_RECEIVE,
|
||||
LWS_CALLBACK_CLIENT_RECEIVE_PONG,
|
||||
LWS_CALLBACK_CLIENT_WRITEABLE,
|
||||
LWS_CALLBACK_SERVER_WRITEABLE,
|
||||
LWS_CALLBACK_HTTP,
|
||||
LWS_CALLBACK_BROADCAST,
|
||||
LWS_CALLBACK_FILTER_NETWORK_CONNECTION,
|
||||
|
@ -244,12 +245,15 @@ struct libwebsocket_context;
|
|||
* libwebsockets_serve_http_file() makes it very
|
||||
* simple to send back a file to the client.
|
||||
*
|
||||
* LWS_CALLBACK_CLIENT_WRITEABLE: if you call
|
||||
* LWS_CALLBACK_CLIENT_WRITEABLE:
|
||||
* LWS_CALLBACK_SERVER_WRITEABLE: If you call
|
||||
* libwebsocket_callback_on_writable() on a connection, you will
|
||||
* get this callback coming when the connection socket is able to
|
||||
* accept another write packet without blocking. If it already
|
||||
* was able to take another packet without blocking, you'll get
|
||||
* this callback at the next call to the service loop function.
|
||||
* get one of these callbacks coming when the connection socket
|
||||
* is able to accept another write packet without blocking.
|
||||
* If it already was able to take another packet without blocking,
|
||||
* you'll get this callback at the next call to the service loop
|
||||
* function. Notice that CLIENTs get LWS_CALLBACK_CLIENT_WRITEABLE
|
||||
* and servers get LWS_CALLBACK_SERVER_WRITEABLE.
|
||||
*
|
||||
* LWS_CALLBACK_FILTER_NETWORK_CONNECTION: called when a client connects to
|
||||
* the server at network level; the connection is accepted but then
|
||||
|
|
|
@ -311,7 +311,7 @@ callback_lws_mirror(struct libwebsocket_context * this,
|
|||
libwebsocket_callback_on_writable(this, wsi);
|
||||
break;
|
||||
|
||||
case LWS_CALLBACK_CLIENT_WRITEABLE:
|
||||
case LWS_CALLBACK_SERVER_WRITEABLE:
|
||||
|
||||
if (pss->ringbuffer_tail != ringbuffer_head) {
|
||||
|
||||
|
|
|
@ -270,7 +270,7 @@ callback_lws_mirror(struct libwebsocket_context * context,
|
|||
pss->wsi = wsi;
|
||||
break;
|
||||
|
||||
case LWS_CALLBACK_CLIENT_WRITEABLE:
|
||||
case LWS_CALLBACK_SERVER_WRITEABLE:
|
||||
if (close_testing)
|
||||
break;
|
||||
if (pss->ringbuffer_tail != ringbuffer_head) {
|
||||
|
|
Loading…
Add table
Reference in a new issue