| 523 | } |
| 524 | |
| 525 | Handle<hv::WebSocketServer> makeWebSocketServer ( int port, int httpsPort, const char * pathToCert, const void * pClass, const StructInfo * info, Context * context, LineInfoArg * at ) { |
| 526 | if ( httpsPort ) { |
| 527 | hssl_ctx_init_param_t param; |
| 528 | memset(¶m, 0, sizeof(param)); |
| 529 | string crt_root = pathToCert ? pathToCert : getDasRoot() + "/modules/dasHV/cert"; |
| 530 | auto crt_file = crt_root + "/server.crt"; |
| 531 | auto key_file = crt_root + "/server.key"; |
| 532 | param.crt_file = crt_file.c_str(); |
| 533 | param.key_file = key_file.c_str(); |
| 534 | param.endpoint = HSSL_SERVER; |
| 535 | if (hssl_ctx_init(¶m) == NULL) { |
| 536 | context->throw_error_at(at, "libHV: hssl_ctx_init failed! Please check the certificate files `%s` and `%s`.", crt_file.c_str(), key_file.c_str()); |
| 537 | } |
| 538 | } |
| 539 | auto adapter = new WebServer_Adapter((char *)pClass,info,context); |
| 540 | adapter->port = port; |
| 541 | adapter->https_port = httpsPort; |
| 542 | shared_ptr<hv::WebSocketServer> sp(adapter); |
| 543 | return HandleRegistry<hv::WebSocketServer>::instance().acquire(sp); |
| 544 | } |
| 545 | |
| 546 | int das_wss_send ( Handle<hv::WebSocketChannel> h, const char * msg, ws_opcode opcode, bool fin ) { |
| 547 | auto p = HandleRegistry<hv::WebSocketChannel>::instance().lookup(h); |
nothing calls this directly
no test coverage detected