summary |
shortlog |
log |
commit | commitdiff |
review |
tree
raw |
patch |
inline | side by side (from parent 1:
5eaa2c1)
Change-Id: I85ee8eb60ef5d37ce1a82044ae317d2a17d3bec8
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
}
/* create the web socket */
}
/* create the web socket */
- ws = proto->create(dup(MHD_get_connection_info(con, MHD_CONNECTION_INFO_CONNECTION_FD)->connect_fd),
+ ws = proto->create(MHD_get_connection_info(con, MHD_CONNECTION_INFO_CONNECTION_FD)->connect_fd,
context,
(void*)MHD_resume_connection,
con);
context,
(void*)MHD_resume_connection,
con);
#include "afb-req-itf.h"
#include "afb-apis.h"
#include "afb-req-itf.h"
#include "afb-apis.h"
-static void aws_on_close(struct afb_ws_json *ws, uint16_t code, char *text, size_t size);
+static void aws_on_hangup(struct afb_ws_json *ws);
static void aws_on_text(struct afb_ws_json *ws, char *text, size_t size);
static struct afb_ws_itf aws_itf = {
static void aws_on_text(struct afb_ws_json *ws, char *text, size_t size);
static struct afb_ws_itf aws_itf = {
- .on_close = (void*)aws_on_close,
- .on_text = (void*)aws_on_text,
- .on_binary = NULL,
+ .on_hangup = (void*)aws_on_hangup,
+ .on_text = (void*)aws_on_text
static void aws_send_event(struct afb_ws_json *ws, const char *event, struct json_object *object);
static const struct afb_event_sender_itf event_sender_itf = {
static void aws_send_event(struct afb_ws_json *ws, const char *event, struct json_object *object);
static const struct afb_event_sender_itf event_sender_itf = {
-static void aws_on_close(struct afb_ws_json *ws, uint16_t code, char *text, size_t size)
+static void aws_on_hangup(struct afb_ws_json *ws)
- /* do nothing but free the text */
- free(text);
+ ctxClientEventSenderRemove(ws->context, (struct afb_event_sender){ .itf = &event_sender_itf, .closure = ws });
+ afb_ws_destroy(ws->ws);
+ json_tokener_free(ws->tokener);
+ if (ws->cleanup != NULL)
+ ws->cleanup(ws->cleanup_closure);
+ free(ws);
/* done */
r->text = text;
r->size = size;
/* done */
r->text = text;
r->size = size;
-fprintf(stderr, "\n\nONTEXT([%d, %.*s, %.*s/%.*s, %.*s, %.*s])\n\n",
- r->code,
- (int)r->idlen, r->id,
- (int)r->apilen, r->api,
- (int)r->verblen, r->verb,
- (int)r->objlen, r->obj,
- (int)r->toklen, r->tok
-);
free(wsreq);
alloc_error:
free(text);
free(wsreq);
alloc_error:
free(text);
- afb_ws_close(ws->ws, 1008);
+ afb_ws_close(ws->ws, 1008, NULL);