mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
introduce lws_send_pipe_choked
Signed-off-by: Andy Green <andy@warmcat.com>
This commit is contained in:
parent
d44bf7f81b
commit
95a7b5d87d
2 changed files with 22 additions and 0 deletions
|
@ -394,6 +394,25 @@ void libwebsockets_00_spam(char *key, int count, int seed)
|
|||
}
|
||||
}
|
||||
|
||||
int lws_send_pipe_choked(struct libwebsocket *wsi)
|
||||
{
|
||||
struct pollfd fds;
|
||||
|
||||
fds.fd = wsi->sock;
|
||||
fds.events = POLLOUT;
|
||||
fds.revents = 0;
|
||||
|
||||
if (poll(&fds, 1, 0) != 1)
|
||||
return 1;
|
||||
|
||||
if ((fds.revents & POLLOUT) == 0)
|
||||
return 1;
|
||||
|
||||
/* okay to send another packet without blocking */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* libwebsocket_service_fd() - Service polled socket with something waiting
|
||||
* @context: Websocket context
|
||||
|
|
|
@ -335,6 +335,9 @@ libwebsockets_get_random(struct libwebsocket_context *context,
|
|||
extern int
|
||||
lws_issue_raw(struct libwebsocket *wsi, unsigned char *buf, size_t len);
|
||||
|
||||
extern int
|
||||
lws_send_pipe_choked(struct libwebsocket *wsi);
|
||||
|
||||
#ifndef LWS_OPENSSL_SUPPORT
|
||||
|
||||
unsigned char *
|
||||
|
|
Loading…
Add table
Reference in a new issue