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

@ -113,15 +113,15 @@ concept adc_netservice_c = requires(SRVT srv, const SRVT srv_const) {
// acceptor type // acceptor type
// requires std::is_class_v<typename SRVT::acceptor_t>; requires std::is_class_v<typename SRVT::acceptor_t>;
// requires adc_async_callback_t<typename SRVT::acceptor_t::async_accept_callback_t>; requires adc_async_callback_t<typename SRVT::acceptor_t::async_accept_callback_t>;
// requires requires(typename SRVT::acceptor_t acc) { requires requires(typename SRVT::acceptor_t acc) {
// acc.asyncAccept(std::declval<typename SRVT::acceptor_t::async_accept_callback_t>(), acc.asyncAccept(std::declval<typename SRVT::acceptor_t::async_accept_callback_t>(),
// std::declval<const typename SRVT::timeout_t&>()); std::declval<const typename SRVT::timeout_t&>());
// // { acc.accept(std::declval<const typename SRVT::timeout_t&>()) } -> std::same_as<SRVT>; // { acc.accept(std::declval<const typename SRVT::timeout_t&>()) } -> std::same_as<SRVT>;
// acc.accept(std::declval<const typename SRVT::timeout_t&>()); acc.accept(std::declval<const typename SRVT::timeout_t&>());
// }; };
// netservice_ident_t ident() const // netservice_ident_t ident() const

View File

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