...
This commit is contained in:
@@ -50,19 +50,25 @@ public:
|
||||
if (endpoint.isTCP()) {
|
||||
asio::ip::tcp::endpoint ept(asio::ip::make_address(endpoint.host()), endpoint.port());
|
||||
using srv_t = AdcNetServiceASIO<asio::ip::tcp, SessProtoT>;
|
||||
base_t::template start<Session<srv_t>>("TCP", this, _ioContext, ept);
|
||||
// base_t::template start<Session<srv_t>>("TCP", this, _ioContext, ept);
|
||||
base_t::template start<Session<srv_t>>("TCP", {this, _sessionRecvTimeout, _sessionSendTimeout}, _ioContext,
|
||||
ept);
|
||||
#ifdef USE_OPENSSL_WITH_ASIO
|
||||
} else if (endpoint.isTLS()) {
|
||||
asio::ip::tcp::endpoint ept(asio::ip::make_address(endpoint.host()), endpoint.port());
|
||||
using srv_t = AdcNetServiceASIOTLS<asio::ip::tcp, SessProtoT>;
|
||||
base_t::template start<Session<srv_t>>("TLS", this, _ioContext, ept, std::move(tls_context),
|
||||
tls_verify_mode);
|
||||
// base_t::template start<Session<srv_t>>("TLS", this, _ioContext, ept, std::move(tls_context),
|
||||
// tls_verify_mode);
|
||||
base_t::template start<Session<srv_t>>("TLS", {this, _sessionRecvTimeout, _sessionSendTimeout}, _ioContext,
|
||||
ept, std::move(tls_context), tls_verify_mode);
|
||||
#endif
|
||||
} else if (endpoint.isLocal()) {
|
||||
if (endpoint.isLocalStream()) {
|
||||
asio::local::stream_protocol::endpoint ept(endpoint.template path<std::string>());
|
||||
using srv_t = AdcNetServiceASIO<asio::local::stream_protocol, SessProtoT>;
|
||||
base_t::template start<Session<srv_t>>("LOCAL STREAM", this, _ioContext, ept);
|
||||
// base_t::template start<Session<srv_t>>("LOCAL STREAM", this, _ioContext, ept);
|
||||
base_t::template start<Session<srv_t>>("LOCAL STREAM", {this, _sessionRecvTimeout, _sessionSendTimeout},
|
||||
_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>;
|
||||
@@ -70,7 +76,9 @@ 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>;
|
||||
base_t::template start<Session<srv_t>>("LOCAL SEQPACK", this, _ioContext, ept);
|
||||
// base_t::template start<Session<srv_t>>("LOCAL SEQPACK", this, _ioContext, ept);
|
||||
base_t::template start<Session<srv_t>>(
|
||||
"LOCAL SEQPACK", {this, _sessionRecvTimeout, _sessionSendTimeout}, _ioContext, ept);
|
||||
}
|
||||
} else {
|
||||
throw std::system_error(std::make_error_code(std::errc::protocol_not_supported));
|
||||
@@ -104,11 +112,24 @@ public:
|
||||
});
|
||||
}
|
||||
|
||||
template <traits::adc_time_duration_c RT, traits::adc_time_duration_c ST>
|
||||
requires(std::convertible_to<RT, std::chrono::milliseconds> &&
|
||||
std::convertible_to<ST, std::chrono::milliseconds>)
|
||||
void setSessionTimeouts(const RT& recv_timeout, const ST& send_timeout)
|
||||
{
|
||||
_sessionRecvTimeout = recv_timeout;
|
||||
_sessionSendTimeout = send_timeout;
|
||||
}
|
||||
|
||||
protected:
|
||||
asio::io_context& _ioContext;
|
||||
|
||||
asio::signal_set _stopSignal, _restartSignal;
|
||||
|
||||
std::chrono::milliseconds _sessionRecvTimeout = std::chrono::hours(12);
|
||||
std::chrono::milliseconds _sessionSendTimeout = std::chrono::seconds(5);
|
||||
|
||||
|
||||
// demonizing ASIO-related methods
|
||||
virtual void daemonizePrepare()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user