1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

introduce LWS_CALLBACK_CLIENT_CONNECTION_ERROR

Signed-off-by: David Brooks <dave@bcs.co.nz>
Signed-off-by: Andy Green <andy@warmcat.com>
--
This commit is contained in:
David Brooks 2012-04-20 12:18:47 +08:00 committed by Andy Green
parent 993343b5e4
commit 80a44975e9
2 changed files with 11 additions and 2 deletions

View file

@ -1425,8 +1425,13 @@ bail3:
free(wsi->c_protocol);
bail2:
if (wsi->c_callback) wsi->c_callback(context, wsi,
LWS_CALLBACK_CLIENT_CONNECTION_ERROR,
wsi->user_space,
NULL, 0);
libwebsocket_close_and_free_session(context, wsi,
LWS_CLOSE_STATUS_NOSTATUS);
LWS_CLOSE_STATUS_NOSTATUS); // But this should be LWS_CLOSE_STATUS_PROTOCOL_ERR
return 1;
}

View file

@ -65,6 +65,7 @@ enum libwebsocket_context_options {
enum libwebsocket_callback_reasons {
LWS_CALLBACK_ESTABLISHED,
LWS_CALLBACK_CLIENT_CONNECTION_ERROR,
LWS_CALLBACK_CLIENT_ESTABLISHED,
LWS_CALLBACK_CLOSED,
LWS_CALLBACK_RECEIVE,
@ -249,7 +250,10 @@ struct libwebsocket_extension;
* LWS_CALLBACK_ESTABLISHED: after the server completes a handshake with
* an incoming client
*
* LWS_CALLBACK_CLIENT_ESTABLISHED: after your client connection completed
* LWS_CALLBACK_CLIENT_CONNECTION_ERROR: the request client connection has
* been unable to complete a handshake with the remote server
*
* LWS_CALLBACK_CLIENT_ESTABLISHED: after your client connection completed
* a handshake with the remote server
*
* LWS_CALLBACK_CLOSED: when the websocket session ends