This commit is contained in:
Timur A. Fatkhullin
2024-10-26 22:16:38 +03:00
parent a496758ca4
commit 7685f4c014
2 changed files with 16 additions and 14 deletions

View File

@@ -31,33 +31,35 @@ public:
}
// may thow here!
// may throw here!
#ifdef USE_OPENSSL_WITH_ASIO
if (endpoint.isTCP() || endpoint.isTLS()) {
asio::ip::tcp::endpoint ept(asio::ip::make_address(endpoint.host()), endpoint.port());
if (endpoint.isTCP()) {
using srv_t = AdcNetServiceASIOBase<asio::ip::tcp, SessProtoT>;
using srv_t = AdcNetServiceASIO<asio::ip::tcp, SessProtoT>;
AdcDeviceNetServer::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);
}
#else
if (endpoint.isTCP()) {
asio::ip::tcp::endpoint ept(asio::ip::make_address(endpoint.host()), endpoint.port());
using srv_t = AdcNetServiceASIOBase<asio::ip::tcp, AdcStopSeqSessionProto<>>;
using srv_t = AdcNetServiceASIO<asio::ip::tcp, AdcStopSeqSessionProto<>>;
AdcDeviceNetServer::start<Session<srv_t>>("TCP", this, _ioContext, ept);
#endif
} else if (endpoint.isLocal()) {
if (endpoint.isLocalStream()) {
asio::local::stream_protocol::endpoint ept(endpoint.template path<std::string>());
using srv_t = AdcNetServiceASIOBase<asio::local::stream_protocol, SessProtoT>;
using srv_t = AdcNetServiceASIO<asio::local::stream_protocol, SessProtoT>;
AdcDeviceNetServer::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 = AdcNetServiceASIOBase<asio::local::datagram_protocol, SessProtoT>;
using srv_t = AdcNetServiceASIO<asio::local::datagram_protocol, SessProtoT>;
AdcDeviceNetServer::start<Session<srv_t>>("LOCAL DGRAM", this, _ioContext, ept);
} else if (endpoint.isLocalSeqpacket()) {
asio::local::seq_packet_protocol::endpoint ept(endpoint.template path<std::string>());
using srv_t = AdcNetServiceASIOBase<asio::local::seq_packet_protocol, SessProtoT>;
using srv_t = AdcNetServiceASIO<asio::local::seq_packet_protocol, SessProtoT>;
AdcDeviceNetServer::start<Session<srv_t>>("LOCAL SEQPACK", this, _ioContext, ept);
}
} else {