2014-04-03 07:36:41 +08:00
|
|
|
/*
|
|
|
|
* libwebsockets - small server side websockets and web server implementation
|
|
|
|
*
|
2018-04-11 13:39:42 +08:00
|
|
|
* Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
|
2014-04-03 07:36:41 +08:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation:
|
|
|
|
* version 2.1 of the License.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
|
|
|
* MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
2018-05-03 10:49:36 +08:00
|
|
|
#include "core/private.h"
|
2014-04-03 07:36:41 +08:00
|
|
|
|
2018-04-11 13:39:42 +08:00
|
|
|
int
|
|
|
|
lws_callback_as_writeable(struct lws *wsi)
|
2014-10-22 15:37:28 +08:00
|
|
|
{
|
2017-05-07 10:02:03 +08:00
|
|
|
struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
|
2017-12-07 07:20:47 +08:00
|
|
|
int n, m;
|
2014-10-22 15:37:28 +08:00
|
|
|
|
2019-08-10 07:32:32 +01:00
|
|
|
lws_stats_bump(pt, LWSSTATS_C_WRITEABLE_CB, 1);
|
2017-05-07 10:02:03 +08:00
|
|
|
#if defined(LWS_WITH_STATS)
|
2017-09-14 13:59:45 +08:00
|
|
|
if (wsi->active_writable_req_us) {
|
2019-08-10 07:32:32 +01:00
|
|
|
uint64_t ul = lws_now_usecs() -
|
2017-09-23 12:55:21 +08:00
|
|
|
wsi->active_writable_req_us;
|
2017-05-07 10:02:03 +08:00
|
|
|
|
2019-08-10 07:32:32 +01:00
|
|
|
lws_stats_bump(pt, LWSSTATS_US_WRITABLE_DELAY_AVG, ul);
|
|
|
|
lws_stats_max(pt, LWSSTATS_US_WORST_WRITABLE_DELAY, ul);
|
2017-05-07 10:02:03 +08:00
|
|
|
wsi->active_writable_req_us = 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2018-04-11 13:39:42 +08:00
|
|
|
n = wsi->role_ops->writeable_cb[lwsi_role_server(wsi)];
|
2017-07-17 10:11:17 +08:00
|
|
|
|
2017-12-07 07:20:47 +08:00
|
|
|
m = user_callback_handle_rxflow(wsi->protocol->callback,
|
2018-04-11 13:39:42 +08:00
|
|
|
wsi, (enum lws_callback_reasons) n,
|
|
|
|
wsi->user_space, NULL, 0);
|
2017-12-07 07:20:47 +08:00
|
|
|
|
|
|
|
return m;
|
2014-10-22 15:37:28 +08:00
|
|
|
}
|
|
|
|
|
2017-07-17 10:11:17 +08:00
|
|
|
LWS_VISIBLE int
|
2015-12-15 21:15:58 +08:00
|
|
|
lws_handle_POLLOUT_event(struct lws *wsi, struct lws_pollfd *pollfd)
|
2014-04-03 07:36:41 +08:00
|
|
|
{
|
2017-11-12 09:16:46 +08:00
|
|
|
volatile struct lws *vwsi = (volatile struct lws *)wsi;
|
2018-04-11 13:39:42 +08:00
|
|
|
int n;
|
2018-03-27 09:17:19 +08:00
|
|
|
|
2018-11-29 08:29:48 +08:00
|
|
|
// lwsl_notice("%s: %p\n", __func__, wsi);
|
2018-03-27 09:17:19 +08:00
|
|
|
|
2017-11-12 09:16:46 +08:00
|
|
|
vwsi->leave_pollout_active = 0;
|
|
|
|
vwsi->handling_pollout = 1;
|
2017-04-05 08:30:55 +08:00
|
|
|
/*
|
|
|
|
* if another thread wants POLLOUT on us, from here on while
|
|
|
|
* handling_pollout is set, he will only set leave_pollout_active.
|
|
|
|
* If we are going to disable POLLOUT, we will check that first.
|
|
|
|
*/
|
2018-04-11 13:39:42 +08:00
|
|
|
wsi->could_have_pending = 0; /* clear back-to-back write detection */
|
2017-04-05 08:30:55 +08:00
|
|
|
|
2016-01-11 11:34:01 +08:00
|
|
|
/*
|
|
|
|
* user callback is lowest priority to get these notifications
|
|
|
|
* actually, since other pending things cannot be disordered
|
2018-04-11 13:39:42 +08:00
|
|
|
*
|
|
|
|
* Priority 1: pending truncated sends are incomplete ws fragments
|
2016-01-11 11:34:01 +08:00
|
|
|
* If anything else sent first the protocol would be
|
|
|
|
* corrupted.
|
http: compression methods
Add generic http compression layer eanbled at cmake with LWS_WITH_HTTP_STREAM_COMPRESSION.
This is wholly a feature of the HTTP role (used by h1 and h2 roles) and doesn't exist
outside that context.
Currently provides 'deflate' and 'br' compression methods for server side only.
'br' requires also -DLWS_WITH_HTTP_BROTLI=1 at cmake and the brotli libraries (available in
your distro already) and dev package.
Other compression methods can be added nicely using an ops struct.
The built-in file serving stuff will use this is the client says he can handle it, and the
mimetype of the file either starts with "text/" (html and css etc) or is the mimetype of
Javascript.
zlib allocates quite a bit while in use, it seems to be around 256KiB per stream. So this
is only useful on relatively strong servers with lots of memory. However for some usecases
where you are serving a lot of css and js assets, it's a nice help.
The patch performs special treatment for http/1.1 pipelining, since the compression is
performed on the fly the compressed content-length is not known until the end. So for h1
only, chunked transfer-encoding is automatically added so pipelining can continue of the
connection.
For h2 the chunking is neither supported nor required, so it "just works".
User code can also request to add a compression transform before the reply headers were
sent using the new api
LWS_VISIBLE int
lws_http_compression_apply(struct lws *wsi, const char *name,
unsigned char **p, unsigned char *end, char decomp);
... this allows transparent compression of dynamically generated HTTP. The requested
compression (eg, "deflate") is only applied if the client headers indicated it was
supported, otherwise it's a NOP.
Name may be NULL in which case the first compression method in the internal table at
stream.c that is mentioned as acceptable by the client will be used.
NOTE: the compression translation, same as h2 support, relies on the user code using
LWS_WRITE_HTTP and then LWS_WRITE_HTTP_FINAL on the last part written. The internal
lws fileserving code already does this.
2018-09-02 14:43:05 +08:00
|
|
|
*
|
|
|
|
* These are post- any compression transform
|
2016-01-11 11:34:01 +08:00
|
|
|
*/
|
2018-04-11 13:39:42 +08:00
|
|
|
|
2018-08-20 12:02:26 +08:00
|
|
|
if (lws_has_buffered_out(wsi)) {
|
2017-10-13 10:33:02 +08:00
|
|
|
//lwsl_notice("%s: completing partial\n", __func__);
|
2018-08-20 12:02:26 +08:00
|
|
|
if (lws_issue_raw(wsi, NULL, 0) < 0) {
|
2015-12-15 21:15:58 +08:00
|
|
|
lwsl_info("%s signalling to close\n", __func__);
|
2017-04-05 08:30:55 +08:00
|
|
|
goto bail_die;
|
2014-04-10 14:25:24 +08:00
|
|
|
}
|
2014-04-03 07:36:41 +08:00
|
|
|
/* leave POLLOUT active either way */
|
2017-04-05 08:30:55 +08:00
|
|
|
goto bail_ok;
|
2014-04-10 17:06:59 +08:00
|
|
|
} else
|
2018-04-02 11:55:17 +08:00
|
|
|
if (lwsi_state(wsi) == LRS_FLUSHING_BEFORE_CLOSE) {
|
2017-05-07 08:19:55 +08:00
|
|
|
wsi->socket_is_permanently_unusable = 1;
|
2017-04-05 08:30:55 +08:00
|
|
|
goto bail_die; /* retry closing now */
|
2017-05-07 08:19:55 +08:00
|
|
|
}
|
2015-12-15 21:15:58 +08:00
|
|
|
|
http: compression methods
Add generic http compression layer eanbled at cmake with LWS_WITH_HTTP_STREAM_COMPRESSION.
This is wholly a feature of the HTTP role (used by h1 and h2 roles) and doesn't exist
outside that context.
Currently provides 'deflate' and 'br' compression methods for server side only.
'br' requires also -DLWS_WITH_HTTP_BROTLI=1 at cmake and the brotli libraries (available in
your distro already) and dev package.
Other compression methods can be added nicely using an ops struct.
The built-in file serving stuff will use this is the client says he can handle it, and the
mimetype of the file either starts with "text/" (html and css etc) or is the mimetype of
Javascript.
zlib allocates quite a bit while in use, it seems to be around 256KiB per stream. So this
is only useful on relatively strong servers with lots of memory. However for some usecases
where you are serving a lot of css and js assets, it's a nice help.
The patch performs special treatment for http/1.1 pipelining, since the compression is
performed on the fly the compressed content-length is not known until the end. So for h1
only, chunked transfer-encoding is automatically added so pipelining can continue of the
connection.
For h2 the chunking is neither supported nor required, so it "just works".
User code can also request to add a compression transform before the reply headers were
sent using the new api
LWS_VISIBLE int
lws_http_compression_apply(struct lws *wsi, const char *name,
unsigned char **p, unsigned char *end, char decomp);
... this allows transparent compression of dynamically generated HTTP. The requested
compression (eg, "deflate") is only applied if the client headers indicated it was
supported, otherwise it's a NOP.
Name may be NULL in which case the first compression method in the internal table at
stream.c that is mentioned as acceptable by the client will be used.
NOTE: the compression translation, same as h2 support, relies on the user code using
LWS_WRITE_HTTP and then LWS_WRITE_HTTP_FINAL on the last part written. The internal
lws fileserving code already does this.
2018-09-02 14:43:05 +08:00
|
|
|
/* Priority 2: pre- compression transform */
|
|
|
|
|
|
|
|
#if defined(LWS_WITH_HTTP_STREAM_COMPRESSION)
|
|
|
|
if (wsi->http.comp_ctx.buflist_comp ||
|
|
|
|
wsi->http.comp_ctx.may_have_more) {
|
|
|
|
enum lws_write_protocol wp = LWS_WRITE_HTTP;
|
|
|
|
|
2018-09-02 14:35:37 +08:00
|
|
|
lwsl_info("%s: completing comp partial (buflist_comp %p, may %d)\n",
|
http: compression methods
Add generic http compression layer eanbled at cmake with LWS_WITH_HTTP_STREAM_COMPRESSION.
This is wholly a feature of the HTTP role (used by h1 and h2 roles) and doesn't exist
outside that context.
Currently provides 'deflate' and 'br' compression methods for server side only.
'br' requires also -DLWS_WITH_HTTP_BROTLI=1 at cmake and the brotli libraries (available in
your distro already) and dev package.
Other compression methods can be added nicely using an ops struct.
The built-in file serving stuff will use this is the client says he can handle it, and the
mimetype of the file either starts with "text/" (html and css etc) or is the mimetype of
Javascript.
zlib allocates quite a bit while in use, it seems to be around 256KiB per stream. So this
is only useful on relatively strong servers with lots of memory. However for some usecases
where you are serving a lot of css and js assets, it's a nice help.
The patch performs special treatment for http/1.1 pipelining, since the compression is
performed on the fly the compressed content-length is not known until the end. So for h1
only, chunked transfer-encoding is automatically added so pipelining can continue of the
connection.
For h2 the chunking is neither supported nor required, so it "just works".
User code can also request to add a compression transform before the reply headers were
sent using the new api
LWS_VISIBLE int
lws_http_compression_apply(struct lws *wsi, const char *name,
unsigned char **p, unsigned char *end, char decomp);
... this allows transparent compression of dynamically generated HTTP. The requested
compression (eg, "deflate") is only applied if the client headers indicated it was
supported, otherwise it's a NOP.
Name may be NULL in which case the first compression method in the internal table at
stream.c that is mentioned as acceptable by the client will be used.
NOTE: the compression translation, same as h2 support, relies on the user code using
LWS_WRITE_HTTP and then LWS_WRITE_HTTP_FINAL on the last part written. The internal
lws fileserving code already does this.
2018-09-02 14:43:05 +08:00
|
|
|
__func__, wsi->http.comp_ctx.buflist_comp,
|
|
|
|
wsi->http.comp_ctx.may_have_more
|
|
|
|
);
|
|
|
|
|
|
|
|
if (wsi->role_ops->write_role_protocol(wsi, NULL, 0, &wp) < 0) {
|
|
|
|
lwsl_info("%s signalling to close\n", __func__);
|
|
|
|
goto bail_die;
|
|
|
|
}
|
|
|
|
lws_callback_on_writable(wsi);
|
|
|
|
|
|
|
|
goto bail_ok;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2018-04-11 13:39:42 +08:00
|
|
|
#ifdef LWS_WITH_CGI
|
2017-09-23 12:55:21 +08:00
|
|
|
/*
|
2018-04-11 13:39:42 +08:00
|
|
|
* A cgi master's wire protocol remains h1 or h2. He is just getting
|
|
|
|
* his data from his child cgis.
|
2016-01-11 11:34:01 +08:00
|
|
|
*/
|
2018-04-27 19:16:50 +08:00
|
|
|
if (wsi->http.cgi) {
|
2017-03-22 20:15:01 +08:00
|
|
|
/* also one shot */
|
|
|
|
if (pollfd)
|
|
|
|
if (lws_change_pollfd(wsi, LWS_POLLOUT, 0)) {
|
|
|
|
lwsl_info("failed at set pollfd\n");
|
|
|
|
return 1;
|
|
|
|
}
|
2016-04-13 11:42:53 +08:00
|
|
|
goto user_service_go_again;
|
2017-03-22 20:15:01 +08:00
|
|
|
}
|
2016-04-13 11:42:53 +08:00
|
|
|
#endif
|
|
|
|
|
2018-04-11 13:39:42 +08:00
|
|
|
/* if we got here, we should have wire protocol ops set on the wsi */
|
|
|
|
assert(wsi->role_ops);
|
2016-07-15 13:41:38 +08:00
|
|
|
|
2018-04-11 13:39:42 +08:00
|
|
|
if (!wsi->role_ops->handle_POLLOUT)
|
2017-04-05 08:30:55 +08:00
|
|
|
goto bail_ok;
|
2015-12-14 08:52:03 +08:00
|
|
|
|
2018-04-11 13:39:42 +08:00
|
|
|
switch ((wsi->role_ops->handle_POLLOUT)(wsi)) {
|
|
|
|
case LWS_HP_RET_BAIL_OK:
|
2017-04-05 08:30:55 +08:00
|
|
|
goto bail_ok;
|
2018-04-11 13:39:42 +08:00
|
|
|
case LWS_HP_RET_BAIL_DIE:
|
2017-04-05 08:30:55 +08:00
|
|
|
goto bail_die;
|
2018-04-11 13:39:42 +08:00
|
|
|
case LWS_HP_RET_USER_SERVICE:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
assert(0);
|
2014-04-03 07:36:41 +08:00
|
|
|
}
|
2018-03-19 08:10:32 +08:00
|
|
|
|
2014-04-03 07:36:41 +08:00
|
|
|
/* one shot */
|
|
|
|
|
2017-04-05 08:30:55 +08:00
|
|
|
if (pollfd) {
|
2017-11-12 09:16:46 +08:00
|
|
|
int eff = vwsi->leave_pollout_active;
|
2017-04-05 08:30:55 +08:00
|
|
|
|
2018-04-17 11:43:20 +08:00
|
|
|
if (!eff) {
|
2017-04-05 08:30:55 +08:00
|
|
|
if (lws_change_pollfd(wsi, LWS_POLLOUT, 0)) {
|
|
|
|
lwsl_info("failed at set pollfd\n");
|
|
|
|
goto bail_die;
|
|
|
|
}
|
2018-04-17 11:43:20 +08:00
|
|
|
}
|
2017-04-05 08:30:55 +08:00
|
|
|
|
2017-11-12 09:16:46 +08:00
|
|
|
vwsi->handling_pollout = 0;
|
2017-04-05 08:30:55 +08:00
|
|
|
|
|
|
|
/* cannot get leave_pollout_active set after the above */
|
2018-02-20 12:07:10 +08:00
|
|
|
if (!eff && wsi->leave_pollout_active) {
|
|
|
|
/*
|
|
|
|
* got set inbetween sampling eff and clearing
|
|
|
|
* handling_pollout, force POLLOUT on
|
|
|
|
*/
|
|
|
|
lwsl_debug("leave_pollout_active\n");
|
|
|
|
if (lws_change_pollfd(wsi, 0, LWS_POLLOUT)) {
|
|
|
|
lwsl_info("failed at set pollfd\n");
|
|
|
|
goto bail_die;
|
|
|
|
}
|
|
|
|
}
|
2017-04-05 08:30:55 +08:00
|
|
|
|
2017-11-12 09:16:46 +08:00
|
|
|
vwsi->leave_pollout_active = 0;
|
2017-04-05 08:30:55 +08:00
|
|
|
}
|
2014-04-11 13:14:37 +08:00
|
|
|
|
2018-11-29 08:29:48 +08:00
|
|
|
if (lwsi_role_client(wsi) && !wsi->hdr_parsing_completed &&
|
2018-04-17 11:43:20 +08:00
|
|
|
lwsi_state(wsi) != LRS_H2_WAITING_TO_SEND_HEADERS &&
|
2018-11-29 08:29:48 +08:00
|
|
|
lwsi_state(wsi) != LRS_ISSUE_HTTP_BODY)
|
2017-04-05 08:30:55 +08:00
|
|
|
goto bail_ok;
|
|
|
|
|
2016-02-27 11:42:22 +08:00
|
|
|
|
2016-04-13 11:42:53 +08:00
|
|
|
#ifdef LWS_WITH_CGI
|
|
|
|
user_service_go_again:
|
|
|
|
#endif
|
|
|
|
|
2018-04-11 13:39:42 +08:00
|
|
|
if (wsi->role_ops->perform_user_POLLOUT) {
|
|
|
|
if (wsi->role_ops->perform_user_POLLOUT(wsi) == -1)
|
|
|
|
goto bail_die;
|
2017-10-13 10:33:02 +08:00
|
|
|
else
|
2018-04-11 13:39:42 +08:00
|
|
|
goto bail_ok;
|
2017-10-13 10:33:02 +08:00
|
|
|
}
|
|
|
|
|
2019-06-07 11:11:46 +01:00
|
|
|
lwsl_debug("%s: %p: non mux: wsistate 0x%lx, ops %s\n", __func__, wsi,
|
|
|
|
(unsigned long)wsi->wsistate, wsi->role_ops->name);
|
2018-03-11 11:26:06 +08:00
|
|
|
|
2017-11-12 09:16:46 +08:00
|
|
|
vwsi = (volatile struct lws *)wsi;
|
|
|
|
vwsi->leave_pollout_active = 0;
|
2017-04-05 08:30:55 +08:00
|
|
|
|
2018-04-11 13:39:42 +08:00
|
|
|
n = lws_callback_as_writeable(wsi);
|
2017-11-12 09:16:46 +08:00
|
|
|
vwsi->handling_pollout = 0;
|
2017-11-05 07:03:13 +08:00
|
|
|
|
2017-11-12 09:16:46 +08:00
|
|
|
if (vwsi->leave_pollout_active)
|
2019-07-13 12:06:33 -07:00
|
|
|
if (lws_change_pollfd(wsi, 0, LWS_POLLOUT))
|
|
|
|
goto bail_die;
|
2017-11-05 07:03:13 +08:00
|
|
|
|
|
|
|
return n;
|
2017-04-05 08:30:55 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* since these don't disable the POLLOUT, they are always doing the
|
|
|
|
* right thing for leave_pollout_active whether it was set or not.
|
|
|
|
*/
|
|
|
|
|
|
|
|
bail_ok:
|
2017-11-12 09:16:46 +08:00
|
|
|
vwsi->handling_pollout = 0;
|
|
|
|
vwsi->leave_pollout_active = 0;
|
2017-04-05 08:30:55 +08:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
bail_die:
|
2017-11-12 09:16:46 +08:00
|
|
|
vwsi->handling_pollout = 0;
|
|
|
|
vwsi->leave_pollout_active = 0;
|
2017-04-05 08:30:55 +08:00
|
|
|
|
|
|
|
return -1;
|
2014-04-03 07:36:41 +08:00
|
|
|
}
|
|
|
|
|
2019-04-19 07:13:40 +01:00
|
|
|
int
|
|
|
|
lws_rxflow_cache(struct lws *wsi, unsigned char *buf, int n, int len)
|
2014-10-08 12:00:53 +08:00
|
|
|
{
|
2018-04-13 16:01:38 +08:00
|
|
|
struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
|
|
|
|
uint8_t *buffered;
|
|
|
|
size_t blen;
|
2019-04-19 07:13:40 +01:00
|
|
|
int ret = LWSRXFC_CACHED, m;
|
2018-04-13 16:01:38 +08:00
|
|
|
|
2014-10-08 12:00:53 +08:00
|
|
|
/* his RX is flowcontrolled, don't send remaining now */
|
2018-04-17 15:35:15 +08:00
|
|
|
blen = lws_buflist_next_segment_len(&wsi->buflist, &buffered);
|
2018-04-13 16:01:38 +08:00
|
|
|
if (blen) {
|
2019-07-01 05:53:08 +01:00
|
|
|
if (buf >= buffered && buf + len <= buffered + blen &&
|
|
|
|
blen != (size_t)len) {
|
2019-04-19 07:13:40 +01:00
|
|
|
/*
|
|
|
|
* rxflow while we were spilling prev rxflow
|
|
|
|
*
|
|
|
|
* len indicates how much was unused, then... so trim
|
|
|
|
* the head buflist to match that situation
|
|
|
|
*/
|
|
|
|
|
|
|
|
lws_buflist_use_segment(&wsi->buflist, blen - len);
|
|
|
|
lwsl_debug("%s: trim existing rxflow %d -> %d\n",
|
|
|
|
__func__, (int)blen, (int)len);
|
2018-04-13 16:01:38 +08:00
|
|
|
|
2019-04-19 07:13:40 +01:00
|
|
|
return LWSRXFC_TRIMMED;
|
2017-10-13 10:33:02 +08:00
|
|
|
}
|
2019-04-19 07:13:40 +01:00
|
|
|
ret = LWSRXFC_ADDITIONAL;
|
2014-10-08 12:00:53 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* a new rxflow, buffer it and warn caller */
|
2017-09-23 12:55:21 +08:00
|
|
|
|
2018-04-17 15:35:15 +08:00
|
|
|
m = lws_buflist_append_segment(&wsi->buflist, buf + n, len - n);
|
2018-04-17 11:43:20 +08:00
|
|
|
|
2018-04-13 16:01:38 +08:00
|
|
|
if (m < 0)
|
2019-04-19 07:13:40 +01:00
|
|
|
return LWSRXFC_ERROR;
|
2018-04-17 11:43:20 +08:00
|
|
|
if (m) {
|
|
|
|
lwsl_debug("%s: added %p to rxflow list\n", __func__, wsi);
|
2019-04-21 06:24:05 +01:00
|
|
|
lws_dll2_add_head(&wsi->dll_buflist, &pt->dll_buflist_owner);
|
2018-04-17 11:43:20 +08:00
|
|
|
}
|
2014-10-08 12:00:53 +08:00
|
|
|
|
2018-04-13 16:01:38 +08:00
|
|
|
return ret;
|
2014-10-08 12:00:53 +08:00
|
|
|
}
|
|
|
|
|
ah owns rxbuf
This is intended to solve a longstanding problem with the
relationship between http/1.1 keep-alive and the service
loop.
Ah now contain an rx buffer which is used during header
processing, and the ah may not be detached from the wsi
until the rx buffer is exhausted.
Having the rx buffer in the ah means we can delay using the
rx until a later service loop.
Ah which have pending rx force POLLIN service on the wsi
they are attached to automatically, so we can interleave
general service / connections with draining each ah rx
buffer.
The possible http/1.1 situations and their dispositions are:
1) exactly one set of http headers come. After processing,
the ah is detached since no pending rx left. If more
headers come later, a fresh ah is aqcuired when available
and the rx flow control blocks the read until then.
2) more that one whole set of headers come and we remain in
http mode (no upgrade). The ah is left attached and
returns to the service loop after the first set of headers.
We will get forced service due to the ah having pending
content (respecting flowcontrol) and process the pending
rx in the ah. If we use it all up, we will detach the
ah.
3) one set of http headers come with ws traffic appended.
We service the headers, do the upgrade, and keep the ah
until the remaining ws content is used. When we
exhausted the ws traffix in the ah rx buffer, we
detach the ah.
Since there can be any amount of http/1.1 pipelining on a
connection, and each may be expensive to service, it's now
enforced there is a return to the service loop after each
header set is serviced on a connection.
When I added the forced service for ah with pending buffering,
I added support for it to the windows plat code. However this
is untested.
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-15 12:37:04 +08:00
|
|
|
/* this is used by the platform service code to stop us waiting for network
|
|
|
|
* activity in poll() when we have something that already needs service
|
|
|
|
*/
|
|
|
|
|
2016-10-07 03:19:17 +08:00
|
|
|
LWS_VISIBLE LWS_EXTERN int
|
ah owns rxbuf
This is intended to solve a longstanding problem with the
relationship between http/1.1 keep-alive and the service
loop.
Ah now contain an rx buffer which is used during header
processing, and the ah may not be detached from the wsi
until the rx buffer is exhausted.
Having the rx buffer in the ah means we can delay using the
rx until a later service loop.
Ah which have pending rx force POLLIN service on the wsi
they are attached to automatically, so we can interleave
general service / connections with draining each ah rx
buffer.
The possible http/1.1 situations and their dispositions are:
1) exactly one set of http headers come. After processing,
the ah is detached since no pending rx left. If more
headers come later, a fresh ah is aqcuired when available
and the rx flow control blocks the read until then.
2) more that one whole set of headers come and we remain in
http mode (no upgrade). The ah is left attached and
returns to the service loop after the first set of headers.
We will get forced service due to the ah having pending
content (respecting flowcontrol) and process the pending
rx in the ah. If we use it all up, we will detach the
ah.
3) one set of http headers come with ws traffic appended.
We service the headers, do the upgrade, and keep the ah
until the remaining ws content is used. When we
exhausted the ws traffix in the ah rx buffer, we
detach the ah.
Since there can be any amount of http/1.1 pipelining on a
connection, and each may be expensive to service, it's now
enforced there is a return to the service loop after each
header set is serviced on a connection.
When I added the forced service for ah with pending buffering,
I added support for it to the windows plat code. However this
is untested.
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-15 12:37:04 +08:00
|
|
|
lws_service_adjust_timeout(struct lws_context *context, int timeout_ms, int tsi)
|
|
|
|
{
|
|
|
|
struct lws_context_per_thread *pt = &context->pt[tsi];
|
|
|
|
|
2018-09-02 14:35:37 +08:00
|
|
|
/*
|
|
|
|
* Figure out if we really want to wait in poll()... we only need to
|
|
|
|
* wait if really nothing already to do and we have to wait for
|
|
|
|
* something from network
|
ah owns rxbuf
This is intended to solve a longstanding problem with the
relationship between http/1.1 keep-alive and the service
loop.
Ah now contain an rx buffer which is used during header
processing, and the ah may not be detached from the wsi
until the rx buffer is exhausted.
Having the rx buffer in the ah means we can delay using the
rx until a later service loop.
Ah which have pending rx force POLLIN service on the wsi
they are attached to automatically, so we can interleave
general service / connections with draining each ah rx
buffer.
The possible http/1.1 situations and their dispositions are:
1) exactly one set of http headers come. After processing,
the ah is detached since no pending rx left. If more
headers come later, a fresh ah is aqcuired when available
and the rx flow control blocks the read until then.
2) more that one whole set of headers come and we remain in
http mode (no upgrade). The ah is left attached and
returns to the service loop after the first set of headers.
We will get forced service due to the ah having pending
content (respecting flowcontrol) and process the pending
rx in the ah. If we use it all up, we will detach the
ah.
3) one set of http headers come with ws traffic appended.
We service the headers, do the upgrade, and keep the ah
until the remaining ws content is used. When we
exhausted the ws traffix in the ah rx buffer, we
detach the ah.
Since there can be any amount of http/1.1 pipelining on a
connection, and each may be expensive to service, it's now
enforced there is a return to the service loop after each
header set is serviced on a connection.
When I added the forced service for ah with pending buffering,
I added support for it to the windows plat code. However this
is untested.
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-15 12:37:04 +08:00
|
|
|
*/
|
2018-04-25 08:42:18 +08:00
|
|
|
#if defined(LWS_ROLE_WS) && !defined(LWS_WITHOUT_EXTENSIONS)
|
ah owns rxbuf
This is intended to solve a longstanding problem with the
relationship between http/1.1 keep-alive and the service
loop.
Ah now contain an rx buffer which is used during header
processing, and the ah may not be detached from the wsi
until the rx buffer is exhausted.
Having the rx buffer in the ah means we can delay using the
rx until a later service loop.
Ah which have pending rx force POLLIN service on the wsi
they are attached to automatically, so we can interleave
general service / connections with draining each ah rx
buffer.
The possible http/1.1 situations and their dispositions are:
1) exactly one set of http headers come. After processing,
the ah is detached since no pending rx left. If more
headers come later, a fresh ah is aqcuired when available
and the rx flow control blocks the read until then.
2) more that one whole set of headers come and we remain in
http mode (no upgrade). The ah is left attached and
returns to the service loop after the first set of headers.
We will get forced service due to the ah having pending
content (respecting flowcontrol) and process the pending
rx in the ah. If we use it all up, we will detach the
ah.
3) one set of http headers come with ws traffic appended.
We service the headers, do the upgrade, and keep the ah
until the remaining ws content is used. When we
exhausted the ws traffix in the ah rx buffer, we
detach the ah.
Since there can be any amount of http/1.1 pipelining on a
connection, and each may be expensive to service, it's now
enforced there is a return to the service loop after each
header set is serviced on a connection.
When I added the forced service for ah with pending buffering,
I added support for it to the windows plat code. However this
is untested.
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-15 12:37:04 +08:00
|
|
|
/* 1) if we know we are draining rx ext, do not wait in poll */
|
2018-04-25 08:42:18 +08:00
|
|
|
if (pt->ws.rx_draining_ext_list)
|
2016-04-06 08:36:30 +08:00
|
|
|
return 0;
|
2018-04-19 12:53:53 +08:00
|
|
|
#endif
|
ah owns rxbuf
This is intended to solve a longstanding problem with the
relationship between http/1.1 keep-alive and the service
loop.
Ah now contain an rx buffer which is used during header
processing, and the ah may not be detached from the wsi
until the rx buffer is exhausted.
Having the rx buffer in the ah means we can delay using the
rx until a later service loop.
Ah which have pending rx force POLLIN service on the wsi
they are attached to automatically, so we can interleave
general service / connections with draining each ah rx
buffer.
The possible http/1.1 situations and their dispositions are:
1) exactly one set of http headers come. After processing,
the ah is detached since no pending rx left. If more
headers come later, a fresh ah is aqcuired when available
and the rx flow control blocks the read until then.
2) more that one whole set of headers come and we remain in
http mode (no upgrade). The ah is left attached and
returns to the service loop after the first set of headers.
We will get forced service due to the ah having pending
content (respecting flowcontrol) and process the pending
rx in the ah. If we use it all up, we will detach the
ah.
3) one set of http headers come with ws traffic appended.
We service the headers, do the upgrade, and keep the ah
until the remaining ws content is used. When we
exhausted the ws traffix in the ah rx buffer, we
detach the ah.
Since there can be any amount of http/1.1 pipelining on a
connection, and each may be expensive to service, it's now
enforced there is a return to the service loop after each
header set is serviced on a connection.
When I added the forced service for ah with pending buffering,
I added support for it to the windows plat code. However this
is untested.
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-15 12:37:04 +08:00
|
|
|
|
2019-01-13 06:58:21 +08:00
|
|
|
#if defined(LWS_WITH_TLS)
|
2018-11-23 08:47:56 +08:00
|
|
|
/* 2) if we know we have non-network pending data,
|
|
|
|
* do not wait in poll */
|
2018-05-01 12:41:42 +08:00
|
|
|
|
|
|
|
if (pt->context->tls_ops &&
|
2018-09-02 14:35:37 +08:00
|
|
|
pt->context->tls_ops->fake_POLLIN_for_buffered &&
|
|
|
|
pt->context->tls_ops->fake_POLLIN_for_buffered(pt))
|
2018-05-01 12:41:42 +08:00
|
|
|
return 0;
|
2019-01-13 06:58:21 +08:00
|
|
|
#endif
|
ah owns rxbuf
This is intended to solve a longstanding problem with the
relationship between http/1.1 keep-alive and the service
loop.
Ah now contain an rx buffer which is used during header
processing, and the ah may not be detached from the wsi
until the rx buffer is exhausted.
Having the rx buffer in the ah means we can delay using the
rx until a later service loop.
Ah which have pending rx force POLLIN service on the wsi
they are attached to automatically, so we can interleave
general service / connections with draining each ah rx
buffer.
The possible http/1.1 situations and their dispositions are:
1) exactly one set of http headers come. After processing,
the ah is detached since no pending rx left. If more
headers come later, a fresh ah is aqcuired when available
and the rx flow control blocks the read until then.
2) more that one whole set of headers come and we remain in
http mode (no upgrade). The ah is left attached and
returns to the service loop after the first set of headers.
We will get forced service due to the ah having pending
content (respecting flowcontrol) and process the pending
rx in the ah. If we use it all up, we will detach the
ah.
3) one set of http headers come with ws traffic appended.
We service the headers, do the upgrade, and keep the ah
until the remaining ws content is used. When we
exhausted the ws traffix in the ah rx buffer, we
detach the ah.
Since there can be any amount of http/1.1 pipelining on a
connection, and each may be expensive to service, it's now
enforced there is a return to the service loop after each
header set is serviced on a connection.
When I added the forced service for ah with pending buffering,
I added support for it to the windows plat code. However this
is untested.
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-15 12:37:04 +08:00
|
|
|
|
2019-06-24 07:15:50 +01:00
|
|
|
/*
|
|
|
|
* 4) If there is any wsi with rxflow buffered and in a state to process
|
2018-04-17 15:35:15 +08:00
|
|
|
* it, we should not wait in poll
|
|
|
|
*/
|
|
|
|
|
2019-04-21 06:24:05 +01:00
|
|
|
lws_start_foreach_dll(struct lws_dll2 *, d, pt->dll_buflist_owner.head) {
|
2018-04-17 15:35:15 +08:00
|
|
|
struct lws *wsi = lws_container_of(d, struct lws, dll_buflist);
|
|
|
|
|
2019-04-21 06:24:05 +01:00
|
|
|
if (!lws_is_flowcontrolled(wsi) &&
|
|
|
|
lwsi_state(wsi) != LRS_DEFERRING_ACTION)
|
2016-04-06 08:36:30 +08:00
|
|
|
return 0;
|
2018-04-17 15:35:15 +08:00
|
|
|
|
2018-09-02 14:35:37 +08:00
|
|
|
/*
|
2019-06-24 07:15:50 +01:00
|
|
|
* 5) If any guys with http compression to spill, we shouldn't wait in
|
2018-09-02 14:35:37 +08:00
|
|
|
* poll but hurry along and service them
|
|
|
|
*/
|
|
|
|
|
2018-04-17 15:35:15 +08:00
|
|
|
} lws_end_foreach_dll(d);
|
ah owns rxbuf
This is intended to solve a longstanding problem with the
relationship between http/1.1 keep-alive and the service
loop.
Ah now contain an rx buffer which is used during header
processing, and the ah may not be detached from the wsi
until the rx buffer is exhausted.
Having the rx buffer in the ah means we can delay using the
rx until a later service loop.
Ah which have pending rx force POLLIN service on the wsi
they are attached to automatically, so we can interleave
general service / connections with draining each ah rx
buffer.
The possible http/1.1 situations and their dispositions are:
1) exactly one set of http headers come. After processing,
the ah is detached since no pending rx left. If more
headers come later, a fresh ah is aqcuired when available
and the rx flow control blocks the read until then.
2) more that one whole set of headers come and we remain in
http mode (no upgrade). The ah is left attached and
returns to the service loop after the first set of headers.
We will get forced service due to the ah having pending
content (respecting flowcontrol) and process the pending
rx in the ah. If we use it all up, we will detach the
ah.
3) one set of http headers come with ws traffic appended.
We service the headers, do the upgrade, and keep the ah
until the remaining ws content is used. When we
exhausted the ws traffix in the ah rx buffer, we
detach the ah.
Since there can be any amount of http/1.1 pipelining on a
connection, and each may be expensive to service, it's now
enforced there is a return to the service loop after each
header set is serviced on a connection.
When I added the forced service for ah with pending buffering,
I added support for it to the windows plat code. However this
is untested.
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-15 12:37:04 +08:00
|
|
|
|
|
|
|
return timeout_ms;
|
|
|
|
}
|
|
|
|
|
2018-04-30 19:17:32 +08:00
|
|
|
/*
|
|
|
|
* POLLIN said there is something... we must read it, and either use it; or
|
|
|
|
* if other material already in the buflist append it and return the buflist
|
|
|
|
* head material.
|
|
|
|
*/
|
2018-04-11 13:39:42 +08:00
|
|
|
int
|
2018-04-17 15:35:15 +08:00
|
|
|
lws_buflist_aware_read(struct lws_context_per_thread *pt, struct lws *wsi,
|
|
|
|
struct lws_tokens *ebuf)
|
2018-04-11 13:39:42 +08:00
|
|
|
{
|
2018-04-30 19:17:32 +08:00
|
|
|
int n, prior = (int)lws_buflist_next_segment_len(&wsi->buflist, NULL);
|
|
|
|
|
2019-05-30 08:21:33 +08:00
|
|
|
ebuf->token = pt->serv_buf;
|
2018-04-30 19:17:32 +08:00
|
|
|
ebuf->len = lws_ssl_capable_read(wsi, pt->serv_buf,
|
|
|
|
wsi->context->pt_serv_buf_size);
|
|
|
|
|
|
|
|
if (ebuf->len == LWS_SSL_CAPABLE_MORE_SERVICE && prior)
|
|
|
|
goto get_from_buflist;
|
2018-04-11 13:39:42 +08:00
|
|
|
|
2018-04-30 19:17:32 +08:00
|
|
|
if (ebuf->len <= 0)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
/* nothing in buflist already? Then just use what we read */
|
|
|
|
|
|
|
|
if (!prior)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
/* stash what we read */
|
2018-04-11 13:39:42 +08:00
|
|
|
|
2019-05-30 08:21:33 +08:00
|
|
|
n = lws_buflist_append_segment(&wsi->buflist, ebuf->token,
|
2018-04-30 19:17:32 +08:00
|
|
|
ebuf->len);
|
|
|
|
if (n < 0)
|
|
|
|
return -1;
|
|
|
|
if (n) {
|
|
|
|
lwsl_debug("%s: added %p to rxflow list\n", __func__, wsi);
|
2019-04-21 06:24:05 +01:00
|
|
|
lws_dll2_add_head(&wsi->dll_buflist, &pt->dll_buflist_owner);
|
2018-04-11 13:39:42 +08:00
|
|
|
}
|
|
|
|
|
2018-04-30 19:17:32 +08:00
|
|
|
/* get the first buflist guy in line */
|
|
|
|
|
|
|
|
get_from_buflist:
|
|
|
|
|
|
|
|
ebuf->len = (int)lws_buflist_next_segment_len(&wsi->buflist,
|
2019-05-30 08:21:33 +08:00
|
|
|
&ebuf->token);
|
2018-04-30 19:17:32 +08:00
|
|
|
|
|
|
|
return 1; /* came from buflist */
|
2018-04-17 15:35:15 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
lws_buflist_aware_consume(struct lws *wsi, struct lws_tokens *ebuf, int used,
|
|
|
|
int buffered)
|
|
|
|
{
|
2018-04-30 19:17:32 +08:00
|
|
|
struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
|
2018-04-17 15:35:15 +08:00
|
|
|
int m;
|
2018-04-11 13:39:42 +08:00
|
|
|
|
2018-04-30 19:17:32 +08:00
|
|
|
/* it's in the buflist; we didn't use any */
|
|
|
|
|
|
|
|
if (!used && buffered)
|
|
|
|
return 0;
|
2018-04-11 13:39:42 +08:00
|
|
|
|
2018-04-17 15:35:15 +08:00
|
|
|
if (used && buffered) {
|
|
|
|
m = lws_buflist_use_segment(&wsi->buflist, used);
|
|
|
|
lwsl_info("%s: draining rxflow: used %d, next %d\n",
|
|
|
|
__func__, used, m);
|
|
|
|
if (m)
|
|
|
|
return 0;
|
|
|
|
|
2018-04-20 10:33:23 +08:00
|
|
|
lwsl_info("%s: removed %p from dll_buflist\n", __func__, wsi);
|
2019-04-21 06:24:05 +01:00
|
|
|
lws_dll2_remove(&wsi->dll_buflist);
|
2018-04-17 15:35:15 +08:00
|
|
|
|
2018-04-11 13:39:42 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2018-04-17 15:35:15 +08:00
|
|
|
/* any remainder goes on the buflist */
|
2018-04-11 13:39:42 +08:00
|
|
|
|
2018-04-30 19:17:32 +08:00
|
|
|
if (used != ebuf->len) {
|
|
|
|
m = lws_buflist_append_segment(&wsi->buflist,
|
2019-05-30 08:21:33 +08:00
|
|
|
ebuf->token + used,
|
2018-04-30 19:17:32 +08:00
|
|
|
ebuf->len - used);
|
|
|
|
if (m < 0)
|
|
|
|
return 1; /* OOM */
|
|
|
|
if (m) {
|
2018-11-23 08:47:56 +08:00
|
|
|
lwsl_debug("%s: added %p to rxflow list\n",
|
|
|
|
__func__, wsi);
|
2019-04-21 06:24:05 +01:00
|
|
|
lws_dll2_add_head(&wsi->dll_buflist,
|
|
|
|
&pt->dll_buflist_owner);
|
2018-04-30 19:17:32 +08:00
|
|
|
}
|
|
|
|
}
|
2018-04-17 15:35:15 +08:00
|
|
|
|
|
|
|
return 0;
|
2018-04-11 13:39:42 +08:00
|
|
|
}
|
|
|
|
|
2018-04-17 11:43:20 +08:00
|
|
|
void
|
|
|
|
lws_service_do_ripe_rxflow(struct lws_context_per_thread *pt)
|
|
|
|
{
|
|
|
|
struct lws_pollfd pfd;
|
|
|
|
|
2019-04-21 06:24:05 +01:00
|
|
|
if (!pt->dll_buflist_owner.head)
|
2018-04-17 11:43:20 +08:00
|
|
|
return;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* service all guys with pending rxflow that reached a state they can
|
|
|
|
* accept the pending data
|
|
|
|
*/
|
|
|
|
|
|
|
|
lws_pt_lock(pt, __func__);
|
|
|
|
|
2019-04-21 06:24:05 +01:00
|
|
|
lws_start_foreach_dll_safe(struct lws_dll2 *, d, d1,
|
|
|
|
pt->dll_buflist_owner.head) {
|
2018-04-17 15:35:15 +08:00
|
|
|
struct lws *wsi = lws_container_of(d, struct lws, dll_buflist);
|
2018-04-17 11:43:20 +08:00
|
|
|
|
2018-04-16 19:52:28 +08:00
|
|
|
pfd.events = LWS_POLLIN;
|
|
|
|
pfd.revents = LWS_POLLIN;
|
2018-04-17 11:43:20 +08:00
|
|
|
pfd.fd = -1;
|
|
|
|
|
2019-06-07 11:11:46 +01:00
|
|
|
lwsl_debug("%s: rxflow processing: %p fc=%d, 0x%lx\n", __func__,
|
|
|
|
wsi, lws_is_flowcontrolled(wsi),
|
|
|
|
(unsigned long)wsi->wsistate);
|
2018-04-17 11:43:20 +08:00
|
|
|
|
|
|
|
if (!lws_is_flowcontrolled(wsi) &&
|
|
|
|
lwsi_state(wsi) != LRS_DEFERRING_ACTION &&
|
|
|
|
(wsi->role_ops->handle_POLLIN)(pt, wsi, &pfd) ==
|
2018-04-17 15:35:15 +08:00
|
|
|
LWS_HPI_RET_PLEASE_CLOSE_ME)
|
2018-04-17 11:43:20 +08:00
|
|
|
lws_close_free_wsi(wsi, LWS_CLOSE_STATUS_NOSTATUS,
|
|
|
|
"close_and_handled");
|
|
|
|
|
|
|
|
} lws_end_foreach_dll_safe(d, d1);
|
|
|
|
|
|
|
|
lws_pt_unlock(pt);
|
|
|
|
}
|
2018-04-11 13:39:42 +08:00
|
|
|
|
ah owns rxbuf
This is intended to solve a longstanding problem with the
relationship between http/1.1 keep-alive and the service
loop.
Ah now contain an rx buffer which is used during header
processing, and the ah may not be detached from the wsi
until the rx buffer is exhausted.
Having the rx buffer in the ah means we can delay using the
rx until a later service loop.
Ah which have pending rx force POLLIN service on the wsi
they are attached to automatically, so we can interleave
general service / connections with draining each ah rx
buffer.
The possible http/1.1 situations and their dispositions are:
1) exactly one set of http headers come. After processing,
the ah is detached since no pending rx left. If more
headers come later, a fresh ah is aqcuired when available
and the rx flow control blocks the read until then.
2) more that one whole set of headers come and we remain in
http mode (no upgrade). The ah is left attached and
returns to the service loop after the first set of headers.
We will get forced service due to the ah having pending
content (respecting flowcontrol) and process the pending
rx in the ah. If we use it all up, we will detach the
ah.
3) one set of http headers come with ws traffic appended.
We service the headers, do the upgrade, and keep the ah
until the remaining ws content is used. When we
exhausted the ws traffix in the ah rx buffer, we
detach the ah.
Since there can be any amount of http/1.1 pipelining on a
connection, and each may be expensive to service, it's now
enforced there is a return to the service loop after each
header set is serviced on a connection.
When I added the forced service for ah with pending buffering,
I added support for it to the windows plat code. However this
is untested.
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-15 12:37:04 +08:00
|
|
|
/*
|
|
|
|
* guys that need POLLIN service again without waiting for network action
|
|
|
|
* can force POLLIN here if not flowcontrolled, so they will get service.
|
|
|
|
*
|
|
|
|
* Return nonzero if anybody got their POLLIN faked
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
lws_service_flag_pending(struct lws_context *context, int tsi)
|
|
|
|
{
|
|
|
|
struct lws_context_per_thread *pt = &context->pt[tsi];
|
|
|
|
int forced = 0;
|
|
|
|
|
2018-03-02 14:22:49 +08:00
|
|
|
lws_pt_lock(pt, __func__);
|
|
|
|
|
2018-04-17 11:43:20 +08:00
|
|
|
/*
|
2018-04-19 12:53:53 +08:00
|
|
|
* 1) If there is any wsi with a buflist and in a state to process
|
2018-04-17 11:43:20 +08:00
|
|
|
* it, we should not wait in poll
|
|
|
|
*/
|
|
|
|
|
2019-04-21 06:24:05 +01:00
|
|
|
lws_start_foreach_dll(struct lws_dll2 *, d, pt->dll_buflist_owner.head) {
|
2018-04-17 15:35:15 +08:00
|
|
|
struct lws *wsi = lws_container_of(d, struct lws, dll_buflist);
|
2018-04-17 11:43:20 +08:00
|
|
|
|
2019-04-21 06:24:05 +01:00
|
|
|
if (!lws_is_flowcontrolled(wsi) &&
|
|
|
|
lwsi_state(wsi) != LRS_DEFERRING_ACTION) {
|
2018-04-17 11:43:20 +08:00
|
|
|
forced = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} lws_end_foreach_dll(d);
|
|
|
|
|
2018-04-11 13:39:42 +08:00
|
|
|
#if defined(LWS_ROLE_WS)
|
|
|
|
forced |= role_ops_ws.service_flag_pending(context, tsi);
|
|
|
|
#endif
|
ah owns rxbuf
This is intended to solve a longstanding problem with the
relationship between http/1.1 keep-alive and the service
loop.
Ah now contain an rx buffer which is used during header
processing, and the ah may not be detached from the wsi
until the rx buffer is exhausted.
Having the rx buffer in the ah means we can delay using the
rx until a later service loop.
Ah which have pending rx force POLLIN service on the wsi
they are attached to automatically, so we can interleave
general service / connections with draining each ah rx
buffer.
The possible http/1.1 situations and their dispositions are:
1) exactly one set of http headers come. After processing,
the ah is detached since no pending rx left. If more
headers come later, a fresh ah is aqcuired when available
and the rx flow control blocks the read until then.
2) more that one whole set of headers come and we remain in
http mode (no upgrade). The ah is left attached and
returns to the service loop after the first set of headers.
We will get forced service due to the ah having pending
content (respecting flowcontrol) and process the pending
rx in the ah. If we use it all up, we will detach the
ah.
3) one set of http headers come with ws traffic appended.
We service the headers, do the upgrade, and keep the ah
until the remaining ws content is used. When we
exhausted the ws traffix in the ah rx buffer, we
detach the ah.
Since there can be any amount of http/1.1 pipelining on a
connection, and each may be expensive to service, it's now
enforced there is a return to the service loop after each
header set is serviced on a connection.
When I added the forced service for ah with pending buffering,
I added support for it to the windows plat code. However this
is untested.
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-15 12:37:04 +08:00
|
|
|
|
2018-04-11 13:39:42 +08:00
|
|
|
#if defined(LWS_WITH_TLS)
|
ah owns rxbuf
This is intended to solve a longstanding problem with the
relationship between http/1.1 keep-alive and the service
loop.
Ah now contain an rx buffer which is used during header
processing, and the ah may not be detached from the wsi
until the rx buffer is exhausted.
Having the rx buffer in the ah means we can delay using the
rx until a later service loop.
Ah which have pending rx force POLLIN service on the wsi
they are attached to automatically, so we can interleave
general service / connections with draining each ah rx
buffer.
The possible http/1.1 situations and their dispositions are:
1) exactly one set of http headers come. After processing,
the ah is detached since no pending rx left. If more
headers come later, a fresh ah is aqcuired when available
and the rx flow control blocks the read until then.
2) more that one whole set of headers come and we remain in
http mode (no upgrade). The ah is left attached and
returns to the service loop after the first set of headers.
We will get forced service due to the ah having pending
content (respecting flowcontrol) and process the pending
rx in the ah. If we use it all up, we will detach the
ah.
3) one set of http headers come with ws traffic appended.
We service the headers, do the upgrade, and keep the ah
until the remaining ws content is used. When we
exhausted the ws traffix in the ah rx buffer, we
detach the ah.
Since there can be any amount of http/1.1 pipelining on a
connection, and each may be expensive to service, it's now
enforced there is a return to the service loop after each
header set is serviced on a connection.
When I added the forced service for ah with pending buffering,
I added support for it to the windows plat code. However this
is untested.
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-15 12:37:04 +08:00
|
|
|
/*
|
|
|
|
* 2) For all guys with buffered SSL read data already saved up, if they
|
|
|
|
* are not flowcontrolled, fake their POLLIN status so they'll get
|
|
|
|
* service to use up the buffered incoming data, even though their
|
|
|
|
* network socket may have nothing
|
|
|
|
*/
|
2019-08-08 16:58:55 +01:00
|
|
|
lws_start_foreach_dll_safe(struct lws_dll2 *, p, p1,
|
|
|
|
lws_dll2_get_head(&pt->tls.dll_pending_tls_owner)) {
|
2018-11-23 08:47:56 +08:00
|
|
|
struct lws *wsi = lws_container_of(p, struct lws,
|
2019-03-20 07:39:55 +08:00
|
|
|
tls.dll_pending_tls);
|
2018-11-05 14:43:50 +08:00
|
|
|
|
ah owns rxbuf
This is intended to solve a longstanding problem with the
relationship between http/1.1 keep-alive and the service
loop.
Ah now contain an rx buffer which is used during header
processing, and the ah may not be detached from the wsi
until the rx buffer is exhausted.
Having the rx buffer in the ah means we can delay using the
rx until a later service loop.
Ah which have pending rx force POLLIN service on the wsi
they are attached to automatically, so we can interleave
general service / connections with draining each ah rx
buffer.
The possible http/1.1 situations and their dispositions are:
1) exactly one set of http headers come. After processing,
the ah is detached since no pending rx left. If more
headers come later, a fresh ah is aqcuired when available
and the rx flow control blocks the read until then.
2) more that one whole set of headers come and we remain in
http mode (no upgrade). The ah is left attached and
returns to the service loop after the first set of headers.
We will get forced service due to the ah having pending
content (respecting flowcontrol) and process the pending
rx in the ah. If we use it all up, we will detach the
ah.
3) one set of http headers come with ws traffic appended.
We service the headers, do the upgrade, and keep the ah
until the remaining ws content is used. When we
exhausted the ws traffix in the ah rx buffer, we
detach the ah.
Since there can be any amount of http/1.1 pipelining on a
connection, and each may be expensive to service, it's now
enforced there is a return to the service loop after each
header set is serviced on a connection.
When I added the forced service for ah with pending buffering,
I added support for it to the windows plat code. However this
is untested.
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-15 12:37:04 +08:00
|
|
|
pt->fds[wsi->position_in_fds_table].revents |=
|
|
|
|
pt->fds[wsi->position_in_fds_table].events & LWS_POLLIN;
|
|
|
|
if (pt->fds[wsi->position_in_fds_table].revents & LWS_POLLIN) {
|
|
|
|
forced = 1;
|
|
|
|
/*
|
|
|
|
* he's going to get serviced now, take him off the
|
|
|
|
* list of guys with buffered SSL. If he still has some
|
|
|
|
* at the end of the service, he'll get put back on the
|
|
|
|
* list then.
|
|
|
|
*/
|
2018-03-05 16:49:28 +08:00
|
|
|
__lws_ssl_remove_wsi_from_buffered_list(wsi);
|
ah owns rxbuf
This is intended to solve a longstanding problem with the
relationship between http/1.1 keep-alive and the service
loop.
Ah now contain an rx buffer which is used during header
processing, and the ah may not be detached from the wsi
until the rx buffer is exhausted.
Having the rx buffer in the ah means we can delay using the
rx until a later service loop.
Ah which have pending rx force POLLIN service on the wsi
they are attached to automatically, so we can interleave
general service / connections with draining each ah rx
buffer.
The possible http/1.1 situations and their dispositions are:
1) exactly one set of http headers come. After processing,
the ah is detached since no pending rx left. If more
headers come later, a fresh ah is aqcuired when available
and the rx flow control blocks the read until then.
2) more that one whole set of headers come and we remain in
http mode (no upgrade). The ah is left attached and
returns to the service loop after the first set of headers.
We will get forced service due to the ah having pending
content (respecting flowcontrol) and process the pending
rx in the ah. If we use it all up, we will detach the
ah.
3) one set of http headers come with ws traffic appended.
We service the headers, do the upgrade, and keep the ah
until the remaining ws content is used. When we
exhausted the ws traffix in the ah rx buffer, we
detach the ah.
Since there can be any amount of http/1.1 pipelining on a
connection, and each may be expensive to service, it's now
enforced there is a return to the service loop after each
header set is serviced on a connection.
When I added the forced service for ah with pending buffering,
I added support for it to the windows plat code. However this
is untested.
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-15 12:37:04 +08:00
|
|
|
}
|
|
|
|
|
2018-11-05 14:43:50 +08:00
|
|
|
} lws_end_foreach_dll_safe(p, p1);
|
ah owns rxbuf
This is intended to solve a longstanding problem with the
relationship between http/1.1 keep-alive and the service
loop.
Ah now contain an rx buffer which is used during header
processing, and the ah may not be detached from the wsi
until the rx buffer is exhausted.
Having the rx buffer in the ah means we can delay using the
rx until a later service loop.
Ah which have pending rx force POLLIN service on the wsi
they are attached to automatically, so we can interleave
general service / connections with draining each ah rx
buffer.
The possible http/1.1 situations and their dispositions are:
1) exactly one set of http headers come. After processing,
the ah is detached since no pending rx left. If more
headers come later, a fresh ah is aqcuired when available
and the rx flow control blocks the read until then.
2) more that one whole set of headers come and we remain in
http mode (no upgrade). The ah is left attached and
returns to the service loop after the first set of headers.
We will get forced service due to the ah having pending
content (respecting flowcontrol) and process the pending
rx in the ah. If we use it all up, we will detach the
ah.
3) one set of http headers come with ws traffic appended.
We service the headers, do the upgrade, and keep the ah
until the remaining ws content is used. When we
exhausted the ws traffix in the ah rx buffer, we
detach the ah.
Since there can be any amount of http/1.1 pipelining on a
connection, and each may be expensive to service, it's now
enforced there is a return to the service loop after each
header set is serviced on a connection.
When I added the forced service for ah with pending buffering,
I added support for it to the windows plat code. However this
is untested.
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-15 12:37:04 +08:00
|
|
|
#endif
|
2018-04-11 13:39:42 +08:00
|
|
|
|
2018-03-02 14:22:49 +08:00
|
|
|
lws_pt_unlock(pt);
|
|
|
|
|
ah owns rxbuf
This is intended to solve a longstanding problem with the
relationship between http/1.1 keep-alive and the service
loop.
Ah now contain an rx buffer which is used during header
processing, and the ah may not be detached from the wsi
until the rx buffer is exhausted.
Having the rx buffer in the ah means we can delay using the
rx until a later service loop.
Ah which have pending rx force POLLIN service on the wsi
they are attached to automatically, so we can interleave
general service / connections with draining each ah rx
buffer.
The possible http/1.1 situations and their dispositions are:
1) exactly one set of http headers come. After processing,
the ah is detached since no pending rx left. If more
headers come later, a fresh ah is aqcuired when available
and the rx flow control blocks the read until then.
2) more that one whole set of headers come and we remain in
http mode (no upgrade). The ah is left attached and
returns to the service loop after the first set of headers.
We will get forced service due to the ah having pending
content (respecting flowcontrol) and process the pending
rx in the ah. If we use it all up, we will detach the
ah.
3) one set of http headers come with ws traffic appended.
We service the headers, do the upgrade, and keep the ah
until the remaining ws content is used. When we
exhausted the ws traffix in the ah rx buffer, we
detach the ah.
Since there can be any amount of http/1.1 pipelining on a
connection, and each may be expensive to service, it's now
enforced there is a return to the service loop after each
header set is serviced on a connection.
When I added the forced service for ah with pending buffering,
I added support for it to the windows plat code. However this
is untested.
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-15 12:37:04 +08:00
|
|
|
return forced;
|
|
|
|
}
|
|
|
|
|
2018-04-11 13:39:42 +08:00
|
|
|
LWS_VISIBLE int
|
|
|
|
lws_service_fd_tsi(struct lws_context *context, struct lws_pollfd *pollfd,
|
|
|
|
int tsi)
|
|
|
|
{
|
|
|
|
struct lws_context_per_thread *pt = &context->pt[tsi];
|
|
|
|
struct lws *wsi;
|
2014-04-03 07:36:41 +08:00
|
|
|
|
2019-08-09 10:12:09 +01:00
|
|
|
if (!context || context->being_destroyed1 )
|
2018-04-30 09:16:04 +08:00
|
|
|
return -1;
|
|
|
|
|
2018-11-14 20:04:14 +08:00
|
|
|
if (!pollfd) {
|
2019-08-09 10:12:09 +01:00
|
|
|
/*
|
|
|
|
* calling with NULL pollfd for periodic background processing
|
|
|
|
* is no longer needed and is now illegal.
|
|
|
|
*/
|
|
|
|
assert(pollfd);
|
|
|
|
return -1;
|
2018-11-14 20:04:14 +08:00
|
|
|
}
|
2019-03-20 07:39:55 +08:00
|
|
|
assert(lws_socket_is_valid(pollfd->fd));
|
|
|
|
|
2014-04-03 07:36:41 +08:00
|
|
|
/* no, here to service a socket descriptor */
|
2015-11-02 20:34:12 +08:00
|
|
|
wsi = wsi_from_fd(context, pollfd->fd);
|
2015-12-06 05:52:09 +08:00
|
|
|
if (!wsi)
|
2014-04-03 07:36:41 +08:00
|
|
|
/* not lws connection ... leave revents alone and return */
|
|
|
|
return 0;
|
|
|
|
|
2019-02-23 05:41:30 +08:00
|
|
|
#if LWS_MAX_SMP > 1
|
|
|
|
if (wsi->undergoing_init_from_other_pt)
|
|
|
|
/*
|
|
|
|
* Temporary situation that other service thread is initializing
|
|
|
|
* this wsi right now for use on our service thread.
|
|
|
|
*/
|
|
|
|
return 0;
|
|
|
|
#endif
|
|
|
|
|
2014-04-03 07:36:41 +08:00
|
|
|
/*
|
|
|
|
* so that caller can tell we handled, past here we need to
|
|
|
|
* zero down pollfd->revents after handling
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* handle session socket closed */
|
|
|
|
|
2016-01-26 20:56:56 +08:00
|
|
|
if ((!(pollfd->revents & pollfd->events & LWS_POLLIN)) &&
|
2015-12-28 14:24:49 +08:00
|
|
|
(pollfd->revents & LWS_POLLHUP)) {
|
2016-01-27 08:50:31 +08:00
|
|
|
wsi->socket_is_permanently_unusable = 1;
|
2014-04-03 07:36:41 +08:00
|
|
|
lwsl_debug("Session Socket %p (fd=%d) dead\n",
|
2018-04-11 13:39:42 +08:00
|
|
|
(void *)wsi, pollfd->fd);
|
2014-04-03 07:36:41 +08:00
|
|
|
|
|
|
|
goto close_and_handled;
|
|
|
|
}
|
2015-12-17 15:35:41 +08:00
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
if (pollfd->revents & LWS_POLLOUT)
|
|
|
|
wsi->sock_send_blocking = FALSE;
|
2015-11-08 12:10:26 +08:00
|
|
|
#endif
|
2014-04-03 07:36:41 +08:00
|
|
|
|
2017-07-28 18:01:14 +02:00
|
|
|
if ((!(pollfd->revents & pollfd->events & LWS_POLLIN)) &&
|
2017-10-18 09:41:44 +08:00
|
|
|
(pollfd->revents & LWS_POLLHUP)) {
|
2017-05-07 08:19:55 +08:00
|
|
|
lwsl_debug("pollhup\n");
|
|
|
|
wsi->socket_is_permanently_unusable = 1;
|
2017-02-14 09:26:53 +08:00
|
|
|
goto close_and_handled;
|
2017-05-07 08:19:55 +08:00
|
|
|
}
|
2016-02-21 21:25:48 +08:00
|
|
|
|
2018-04-11 13:39:42 +08:00
|
|
|
#if defined(LWS_WITH_TLS)
|
2018-05-02 18:35:58 +08:00
|
|
|
if (lwsi_state(wsi) == LRS_SHUTDOWN &&
|
|
|
|
lws_is_ssl(wsi) && wsi->tls.ssl) {
|
2018-03-11 11:26:06 +08:00
|
|
|
switch (__lws_tls_shutdown(wsi)) {
|
2017-10-18 09:41:44 +08:00
|
|
|
case LWS_SSL_CAPABLE_DONE:
|
|
|
|
case LWS_SSL_CAPABLE_ERROR:
|
2017-04-06 19:37:14 +02:00
|
|
|
goto close_and_handled;
|
2017-09-29 11:27:58 +08:00
|
|
|
|
2017-10-18 09:41:44 +08:00
|
|
|
case LWS_SSL_CAPABLE_MORE_SERVICE_READ:
|
|
|
|
case LWS_SSL_CAPABLE_MORE_SERVICE_WRITE:
|
|
|
|
case LWS_SSL_CAPABLE_MORE_SERVICE:
|
2017-04-06 19:37:14 +02:00
|
|
|
goto handled;
|
|
|
|
}
|
|
|
|
}
|
2017-03-10 07:46:05 +08:00
|
|
|
#endif
|
2018-01-25 09:00:08 +08:00
|
|
|
wsi->could_have_pending = 0; /* clear back-to-back write detection */
|
2017-03-10 07:46:05 +08:00
|
|
|
|
2014-04-03 07:36:41 +08:00
|
|
|
/* okay, what we came here to do... */
|
|
|
|
|
2018-04-11 13:39:42 +08:00
|
|
|
/* if we got here, we should have wire protocol ops set on the wsi */
|
|
|
|
assert(wsi->role_ops);
|
2018-04-02 11:55:17 +08:00
|
|
|
|
2018-04-11 13:39:42 +08:00
|
|
|
// lwsl_notice("%s: %s: wsistate 0x%x\n", __func__, wsi->role_ops->name,
|
|
|
|
// wsi->wsistate);
|
2017-10-24 11:59:44 +08:00
|
|
|
|
2018-04-11 13:39:42 +08:00
|
|
|
switch ((wsi->role_ops->handle_POLLIN)(pt, wsi, pollfd)) {
|
2018-04-17 15:35:15 +08:00
|
|
|
case LWS_HPI_RET_WSI_ALREADY_DIED:
|
2018-04-11 13:39:42 +08:00
|
|
|
return 1;
|
|
|
|
case LWS_HPI_RET_HANDLED:
|
|
|
|
break;
|
2018-04-17 15:35:15 +08:00
|
|
|
case LWS_HPI_RET_PLEASE_CLOSE_ME:
|
2018-04-11 13:39:42 +08:00
|
|
|
close_and_handled:
|
|
|
|
lwsl_debug("%p: Close and handled\n", wsi);
|
|
|
|
lws_close_free_wsi(wsi, LWS_CLOSE_STATUS_NOSTATUS,
|
|
|
|
"close_and_handled");
|
2018-04-30 09:16:04 +08:00
|
|
|
#if defined(_DEBUG) && defined(LWS_WITH_LIBUV)
|
2018-04-19 10:08:48 +08:00
|
|
|
/*
|
|
|
|
* confirm close has no problem being called again while
|
|
|
|
* it waits for libuv service to complete the first async
|
|
|
|
* close
|
|
|
|
*/
|
2018-04-30 09:16:04 +08:00
|
|
|
if (context->event_loop_ops == &event_loop_ops_uv)
|
2018-04-19 10:08:48 +08:00
|
|
|
lws_close_free_wsi(wsi, LWS_CLOSE_STATUS_NOSTATUS,
|
|
|
|
"close_and_handled uv repeat test");
|
|
|
|
#endif
|
2017-10-24 11:59:44 +08:00
|
|
|
/*
|
2018-04-11 13:39:42 +08:00
|
|
|
* pollfd may point to something else after the close
|
|
|
|
* due to pollfd swapping scheme on delete on some platforms
|
|
|
|
* we can't clear revents now because it'd be the wrong guy's
|
|
|
|
* revents
|
2016-03-20 11:59:53 +08:00
|
|
|
*/
|
2018-04-02 11:55:17 +08:00
|
|
|
return 1;
|
2018-04-11 13:39:42 +08:00
|
|
|
default:
|
|
|
|
assert(0);
|
|
|
|
}
|
|
|
|
#if defined(LWS_WITH_TLS)
|
2014-04-03 07:36:41 +08:00
|
|
|
handled:
|
2018-04-11 13:39:42 +08:00
|
|
|
#endif
|
2014-04-03 07:36:41 +08:00
|
|
|
pollfd->revents = 0;
|
2018-04-11 13:39:42 +08:00
|
|
|
|
2019-08-09 10:12:09 +01:00
|
|
|
if (!context->protocol_init_done)
|
|
|
|
if (lws_protocol_init(context)) {
|
|
|
|
lwsl_err("%s: lws_protocol_init failed\n", __func__);
|
|
|
|
return -1;
|
|
|
|
}
|
2018-05-02 18:35:58 +08:00
|
|
|
|
2018-04-11 13:39:42 +08:00
|
|
|
return 0;
|
2014-04-03 07:36:41 +08:00
|
|
|
}
|
|
|
|
|
2016-01-19 03:34:24 +08:00
|
|
|
LWS_VISIBLE int
|
|
|
|
lws_service_fd(struct lws_context *context, struct lws_pollfd *pollfd)
|
|
|
|
{
|
|
|
|
return lws_service_fd_tsi(context, pollfd, 0);
|
|
|
|
}
|
|
|
|
|
2014-04-03 07:36:41 +08:00
|
|
|
LWS_VISIBLE int
|
2015-12-04 11:08:32 +08:00
|
|
|
lws_service(struct lws_context *context, int timeout_ms)
|
2014-04-03 07:36:41 +08:00
|
|
|
{
|
2018-05-02 19:27:29 +08:00
|
|
|
struct lws_context_per_thread *pt = &context->pt[0];
|
|
|
|
int n;
|
|
|
|
|
|
|
|
if (!context)
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
pt->inside_service = 1;
|
|
|
|
|
2018-04-29 10:44:36 +08:00
|
|
|
if (context->event_loop_ops->run_pt) {
|
|
|
|
/* we are configured for an event loop */
|
|
|
|
context->event_loop_ops->run_pt(context, 0);
|
|
|
|
|
2018-05-02 19:27:29 +08:00
|
|
|
pt->inside_service = 0;
|
|
|
|
|
2018-04-29 10:44:36 +08:00
|
|
|
return 1;
|
|
|
|
}
|
2018-05-02 19:27:29 +08:00
|
|
|
n = lws_plat_service(context, timeout_ms);
|
|
|
|
|
|
|
|
pt->inside_service = 0;
|
|
|
|
|
|
|
|
return n;
|
2014-04-03 07:36:41 +08:00
|
|
|
}
|
|
|
|
|
2016-01-19 03:34:24 +08:00
|
|
|
LWS_VISIBLE int
|
|
|
|
lws_service_tsi(struct lws_context *context, int timeout_ms, int tsi)
|
|
|
|
{
|
2018-05-02 19:27:29 +08:00
|
|
|
struct lws_context_per_thread *pt = &context->pt[tsi];
|
|
|
|
int n;
|
|
|
|
|
|
|
|
pt->inside_service = 1;
|
2018-11-15 16:33:54 +08:00
|
|
|
#if LWS_MAX_SMP > 1
|
|
|
|
pt->self = pthread_self();
|
|
|
|
#endif
|
2018-05-02 19:27:29 +08:00
|
|
|
|
2018-04-29 10:44:36 +08:00
|
|
|
if (context->event_loop_ops->run_pt) {
|
|
|
|
/* we are configured for an event loop */
|
|
|
|
context->event_loop_ops->run_pt(context, tsi);
|
|
|
|
|
2018-05-02 19:27:29 +08:00
|
|
|
pt->inside_service = 0;
|
|
|
|
|
2018-04-29 10:44:36 +08:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2018-05-02 19:27:29 +08:00
|
|
|
n = _lws_plat_service_tsi(context, timeout_ms, tsi);
|
|
|
|
|
|
|
|
pt->inside_service = 0;
|
|
|
|
|
|
|
|
return n;
|
2016-01-19 03:34:24 +08:00
|
|
|
}
|