@@ -93,7 +93,7 @@ mod os {
9393
9494 use crate :: {
9595 runtime:: { TcpListener , TcpStream } ,
96- service:: config:: TcpConfig ,
96+ service:: config:: { ServiceTimeout , TcpConfig } ,
9797 } ;
9898
9999 use futures:: { FutureExt , StreamExt , prelude:: Stream } ;
@@ -136,15 +136,15 @@ mod os {
136136
137137 #[ derive( Clone ) ]
138138 pub ( crate ) struct MultiTransport {
139- pub ( crate ) timeout : Duration ,
139+ pub ( crate ) timeout : ServiceTimeout ,
140140 pub ( crate ) tcp_config : TcpConfig ,
141141 pub ( crate ) listens_upgrade_modes : Arc < crate :: lock:: Mutex < HashMap < SocketAddr , UpgradeMode > > > ,
142142 #[ cfg( feature = "tls" ) ]
143143 pub ( crate ) tls_config : Option < TlsConfig > ,
144144 }
145145
146146 impl MultiTransport {
147- pub fn new ( timeout : Duration , tcp_config : TcpConfig ) -> Self {
147+ pub fn new ( timeout : ServiceTimeout , tcp_config : TcpConfig ) -> Self {
148148 MultiTransport {
149149 timeout,
150150 tcp_config,
@@ -217,20 +217,23 @@ mod os {
217217 fn dial ( self , address : Multiaddr ) -> Result < Self :: DialFuture > {
218218 match find_type ( & address) {
219219 TransportType :: Tcp => {
220- match TcpTransport :: new ( self . timeout , self . tcp_config . tcp ) . dial ( address) {
220+ match TcpTransport :: new ( self . timeout . timeout , self . tcp_config . tcp ) . dial ( address)
221+ {
221222 Ok ( res) => Ok ( MultiDialFuture :: Tcp ( res) ) ,
222223 Err ( e) => Err ( e) ,
223224 }
224225 }
225226 TransportType :: Onion => {
226- match OnionTransport :: new ( self . timeout , self . tcp_config . tcp ) . dial ( address) {
227+ match OnionTransport :: new ( self . timeout . onion_timeout , self . tcp_config . tcp )
228+ . dial ( address)
229+ {
227230 Ok ( res) => Ok ( MultiDialFuture :: Tcp ( res) ) ,
228231 Err ( e) => Err ( e) ,
229232 }
230233 }
231234 #[ cfg( feature = "ws" ) ]
232235 TransportType :: Ws => {
233- match WsTransport :: new ( self . timeout , self . tcp_config . ws ) . dial ( address) {
236+ match WsTransport :: new ( self . timeout . timeout , self . tcp_config . ws ) . dial ( address) {
234237 Ok ( future) => Ok ( MultiDialFuture :: Ws ( future) ) ,
235238 Err ( e) => Err ( e) ,
236239 }
@@ -247,7 +250,7 @@ mod os {
247250 let tls_config = self . tls_config . ok_or_else ( || {
248251 TransportErrorKind :: TlsError ( "tls config is not set" . to_string ( ) )
249252 } ) ?;
250- TlsTransport :: new ( self . timeout , tls_config, self . tcp_config . tls )
253+ TlsTransport :: new ( self . timeout . timeout , tls_config, self . tcp_config . tls )
251254 . dial ( address)
252255 . map ( MultiDialFuture :: Tls )
253256 }
0 commit comments