File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ use futures;
4
4
use futures:: { Future , Stream } ;
5
5
use server:: upgrade:: async:: { IntoWs , Upgrade } ;
6
6
use server:: InvalidConnection ;
7
- use server:: { NoTlsAcceptor , WsServer } ;
7
+ use server:: { NoTlsAcceptor , OptionalTlsAcceptor , WsServer } ;
8
8
use std;
9
9
use std:: io;
10
10
use std:: net:: SocketAddr ;
@@ -29,6 +29,16 @@ pub type Server<S> = WsServer<S, TcpListener>;
29
29
pub type Incoming < S > =
30
30
Box < Stream < Item = ( Upgrade < S > , SocketAddr ) , Error = InvalidConnection < S , BytesMut > > + Send > ;
31
31
32
+ impl < S > WsServer < S , TcpListener >
33
+ where
34
+ S : OptionalTlsAcceptor ,
35
+ {
36
+ /// Get the socket address of this server
37
+ pub fn local_addr ( & self ) -> io:: Result < SocketAddr > {
38
+ self . listener . local_addr ( )
39
+ }
40
+ }
41
+
32
42
/// Asynchronous methods for creating an async server and accepting incoming connections.
33
43
impl WsServer < NoTlsAcceptor , TcpListener > {
34
44
/// Bind a websocket server to an address.
You can’t perform that action at this time.
0 commit comments