...
This commit is contained in:
@@ -25,7 +25,13 @@ public:
|
||||
|
||||
|
||||
template <interfaces::adc_netsession_proto_c SessProtoT, std::derived_from<AdcEndpointParser> EptT>
|
||||
#ifdef USE_OPENSSL_WITH_ASIO
|
||||
void start(const EptT& endpoint,
|
||||
asio::ssl::context tls_context = asio::ssl::context(asio::ssl::context::tlsv13_server),
|
||||
asio::ssl::verify_mode tls_verify_mode = asio::ssl::context_base::verify_peer)
|
||||
#else
|
||||
void start(const EptT& endpoint)
|
||||
#endif
|
||||
{
|
||||
if (!endpoint.isValid()) {
|
||||
return;
|
||||
@@ -38,10 +44,11 @@ public:
|
||||
asio::ip::tcp::endpoint ept(asio::ip::make_address(endpoint.host()), endpoint.port());
|
||||
if (endpoint.isTCP()) {
|
||||
using srv_t = AdcNetServiceASIO<asio::ip::tcp, SessProtoT>;
|
||||
AdcDeviceNetServer::start<Session<srv_t>>("TCP", this, _ioContext, ept);
|
||||
AdcGenericNetServer::start<Session<srv_t>>("TCP", this, _ioContext, ept);
|
||||
|
||||
} else {
|
||||
using srv_t = AdcNetServiceASIOTLS<asio::ip::tcp, SessProtoT>;
|
||||
AdcDeviceNetServer::start<Session<srv_t>>("TLS", this, _ioContext, ept);
|
||||
AdcGenericNetServer::start<Session<srv_t>>("TLS", this, _ioContext, ept, tls_context, tls_verify_mode);
|
||||
}
|
||||
#else
|
||||
if (endpoint.isTCP()) {
|
||||
@@ -53,7 +60,7 @@ public:
|
||||
if (endpoint.isLocalStream()) {
|
||||
asio::local::stream_protocol::endpoint ept(endpoint.template path<std::string>());
|
||||
using srv_t = AdcNetServiceASIO<asio::local::stream_protocol, SessProtoT>;
|
||||
AdcDeviceNetServer::start<Session<srv_t>>("LOCAL STREAM", this, _ioContext, ept);
|
||||
AdcGenericNetServer::start<Session<srv_t>>("LOCAL STREAM", this, _ioContext, ept);
|
||||
// } else if (endpoint.isLocalDatagram()) {
|
||||
// asio::local::datagram_protocol::endpoint ept(endpoint.template path<std::string>());
|
||||
// using srv_t = AdcNetServiceASIO<asio::local::datagram_protocol, SessProtoT>;
|
||||
@@ -61,7 +68,7 @@ public:
|
||||
} else if (endpoint.isLocalSeqpacket()) {
|
||||
asio::local::seq_packet_protocol::endpoint ept(endpoint.template path<std::string>());
|
||||
using srv_t = AdcNetServiceASIO<asio::local::seq_packet_protocol, SessProtoT>;
|
||||
AdcDeviceNetServer::start<Session<srv_t>>("LOCAL SEQPACK", this, _ioContext, ept);
|
||||
AdcGenericNetServer::start<Session<srv_t>>("LOCAL SEQPACK", this, _ioContext, ept);
|
||||
}
|
||||
} else {
|
||||
throw std::system_error(std::make_error_code(std::errc::protocol_not_supported));
|
||||
|
||||
Reference in New Issue
Block a user