+ struct memo_websocket *memo = cls;
+ void *ws;
+ struct fdev *fdev;
+
+ fdev = afb_fdev_create(sock);
+ if (!fdev) {
+ /* TODO */
+ close_websocket(urh);
+ } else {
+ fdev_set_autoclose(fdev, 0);
+ ws = memo->proto->create(fdev, memo->apiset, &memo->hreq->xreq.context, close_websocket, urh);
+ if (ws == NULL) {
+ /* TODO */
+ close_websocket(urh);
+ }
+ }
+#if MHD_VERSION <= 0x00095900
+ afb_hreq_unref(memo->hreq);
+#endif
+ free(memo);
+}
+
+static int check_websocket_upgrade(struct MHD_Connection *con, const struct protodef *protodefs, struct afb_hreq *hreq, struct afb_apiset *apiset)
+{
+ struct memo_websocket *memo;