stream-ws: Implement upgrade_to_tls

websocket-tls
Andri Yngvason 2023-04-30 16:39:54 +00:00
parent c8d9dcaa2c
commit 9f82432f78
1 changed files with 7 additions and 0 deletions

View File

@ -307,12 +307,19 @@ static void stream_ws_event(struct stream* self, enum stream_event event)
ws->base.on_event(&ws->base, event); ws->base.on_event(&ws->base, event);
} }
static int stream_ws_upgrade_to_tls(struct stream* self, void* context)
{
struct stream_ws* ws = (struct stream_ws*)self;
return stream_upgrade_to_tls(ws->tcp_stream, context);
}
static struct stream_impl impl = { static struct stream_impl impl = {
.close = stream_ws_close, .close = stream_ws_close,
.destroy = stream_ws_destroy, .destroy = stream_ws_destroy,
.read = stream_ws_read, .read = stream_ws_read,
.send = stream_ws_send, .send = stream_ws_send,
.exec_and_send = stream_ws_exec_and_send, .exec_and_send = stream_ws_exec_and_send,
.upgrade_to_tls = stream_ws_upgrade_to_tls,
}; };
struct stream* stream_ws_new(int fd, stream_event_fn on_event, void* userdata) struct stream* stream_ws_new(int fd, stream_event_fn on_event, void* userdata)