client: CONNECTION_ERROR: target at local protocol if possible
Until now LWS_CALLBACK_CLIENT_CONNECTION_ERROR handling could only take place on protocols[0]. This patch changes LWS_CALLBACK_CLIENT_CONNECTION_ERROR to be sent to the protocol the client connection was bound to... if nothing better that is still protocols[0], but if you created the client connection using info.local_protocol_name, it will now be sent to the bound protocol handler instead.
This commit is contained in:
parent
3ed755e52d
commit
a91ed1fa4c
3 changed files with 5 additions and 5 deletions
|
@ -413,7 +413,7 @@ oom4:
|
|||
if (wsi->mode == LWSCM_HTTP_CLIENT ||
|
||||
wsi->mode == LWSCM_HTTP_CLIENT_ACCEPTED ||
|
||||
wsi->mode == LWSCM_WSCL_WAITING_CONNECT) {
|
||||
wsi->vhost->protocols[0].callback(wsi,
|
||||
wsi->protocol->callback(wsi,
|
||||
LWS_CALLBACK_CLIENT_CONNECTION_ERROR,
|
||||
wsi->user_space, (void *)cce, strlen(cce));
|
||||
wsi->already_did_cce = 1;
|
||||
|
@ -429,7 +429,7 @@ oom4:
|
|||
return NULL;
|
||||
|
||||
failed:
|
||||
wsi->vhost->protocols[0].callback(wsi,
|
||||
wsi->protocol->callback(wsi,
|
||||
LWS_CALLBACK_CLIENT_CONNECTION_ERROR,
|
||||
wsi->user_space, (void *)cce, strlen(cce));
|
||||
wsi->already_did_cce = 1;
|
||||
|
|
|
@ -696,7 +696,7 @@ just_kill_connection:
|
|||
if ((wsi->mode == LWSCM_WSCL_WAITING_SERVER_REPLY ||
|
||||
wsi->mode == LWSCM_WSCL_WAITING_CONNECT) &&
|
||||
!wsi->already_did_cce) {
|
||||
wsi->vhost->protocols[0].callback(wsi,
|
||||
wsi->protocol->callback(wsi,
|
||||
LWS_CALLBACK_CLIENT_CONNECTION_ERROR,
|
||||
wsi->user_space, NULL, 0);
|
||||
}
|
||||
|
|
|
@ -741,7 +741,7 @@ __lws_service_timeout_check(struct lws *wsi, time_t sec)
|
|||
*/
|
||||
wsi->socket_is_permanently_unusable = 1;
|
||||
if (wsi->mode == LWSCM_WSCL_WAITING_SSL)
|
||||
wsi->vhost->protocols[0].callback(wsi,
|
||||
wsi->protocol->callback(wsi,
|
||||
LWS_CALLBACK_CLIENT_CONNECTION_ERROR,
|
||||
wsi->user_space,
|
||||
(void *)"Timed out waiting SSL", 21);
|
||||
|
@ -1317,7 +1317,7 @@ lws_service_fd_tsi(struct lws_context *context, struct lws_pollfd *pollfd,
|
|||
wsi->context = context;
|
||||
wsi->vhost = v;
|
||||
wsi->protocol = q->protocol;
|
||||
lwsl_notice("timed cb: vh %s, protocol %s, reason %d\n", v->name, q->protocol->name, q->reason);
|
||||
lwsl_debug("timed cb: vh %s, protocol %s, reason %d\n", v->name, q->protocol->name, q->reason);
|
||||
q->protocol->callback(wsi, q->reason, NULL, NULL, 0);
|
||||
nx = q->next;
|
||||
lws_timed_callback_remove(v, q);
|
||||
|
|
Loading…
Add table
Reference in a new issue