summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Brooks <dave@bcs.co.nz>2012-04-20 12:18:47 +0800
committerAndy Green <andy.green@linaro.org>2012-04-20 12:28:11 +0800
commit80a44975e98a0fdcb42aa75b445ba8d765cca0b6 (patch)
treee605d11ba9f6fc9bb6e22719e375e218b1ed61e9
parent993343b5e426000ef8e0a196730c3fd3ae4bbe89 (diff)
introduce LWS_CALLBACK_CLIENT_CONNECTION_ERROR
Signed-off-by: David Brooks <dave@bcs.co.nz> Signed-off-by: Andy Green <andy@warmcat.com> --
-rw-r--r--lib/libwebsockets.c7
-rw-r--r--lib/libwebsockets.h6
2 files changed, 11 insertions, 2 deletions
diff --git a/lib/libwebsockets.c b/lib/libwebsockets.c
index 13a18c6..15b59f4 100644
--- a/lib/libwebsockets.c
+++ b/lib/libwebsockets.c
@@ -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;
}
diff --git a/lib/libwebsockets.h b/lib/libwebsockets.h
index a26df43..f8bfda4 100644
--- a/lib/libwebsockets.h
+++ b/lib/libwebsockets.h
@@ -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