projects
/
platform
/
upstream
/
libwebsockets.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
2b9fff7
)
raw: defer creation callback until after fds inserted
author
Andy Green
<andy@warmcat.com>
Fri, 7 Apr 2017 03:25:55 +0000
(11:25 +0800)
committer
Andy Green
<andy@warmcat.com>
Fri, 7 Apr 2017 03:25:55 +0000
(11:25 +0800)
lib/server.c
patch
|
blob
|
history
diff --git
a/lib/server.c
b/lib/server.c
index
472e0e0
..
91c37c1
100644
(file)
--- a/
lib/server.c
+++ b/
lib/server.c
@@
-1824,15
+1824,6
@@
lws_adopt_descriptor_vhost(struct lws_vhost *vh, lws_adoption_type type,
else
n = LWS_CALLBACK_RAW_ADOPT;
}
else
n = LWS_CALLBACK_RAW_ADOPT;
}
- if ((new_wsi->protocol->callback)(
- new_wsi, n, new_wsi->user_space, NULL, 0)) {
- if (type & LWS_ADOPT_SOCKET) {
- /* force us off the timeout list by hand */
- lws_set_timeout(new_wsi, NO_PENDING_TIMEOUT, 0);
- compatible_close(new_wsi->desc.sockfd);
- }
- goto bail;
- }
if (!LWS_SSL_ENABLED(new_wsi->vhost) || !(type & LWS_ADOPT_ALLOW_SSL) ||
!(type & LWS_ADOPT_SOCKET)) {
if (!LWS_SSL_ENABLED(new_wsi->vhost) || !(type & LWS_ADOPT_ALLOW_SSL) ||
!(type & LWS_ADOPT_SOCKET)) {
@@
-1868,6
+1859,14
@@
lws_adopt_descriptor_vhost(struct lws_vhost *vh, lws_adoption_type type,
goto fail;
}
goto fail;
}
+ /*
+ * by deferring callback to this point, after insertion to fds,
+ * lws_callback_on_writable() can work from the callback
+ */
+ if ((new_wsi->protocol->callback)(
+ new_wsi, n, new_wsi->user_space, NULL, 0))
+ goto fail;
+
if (type & LWS_ADOPT_HTTP)
if (!lws_header_table_attach(new_wsi, 0))
lwsl_debug("Attached ah immediately\n");
if (type & LWS_ADOPT_HTTP)
if (!lws_header_table_attach(new_wsi, 0))
lwsl_debug("Attached ah immediately\n");