@@ -23,12 +23,12 @@ use windows_sys::Win32::Foundation::{SetHandleInformation, HANDLE, HANDLE_FLAG_I
23
23
use windows_sys:: Win32 :: Networking :: WinSock :: {
24
24
self , tcp_keepalive, FIONBIO , IN6_ADDR , IN6_ADDR_0 , INVALID_SOCKET , IN_ADDR , IN_ADDR_0 ,
25
25
POLLERR , POLLHUP , POLLRDNORM , POLLWRNORM , SD_BOTH , SD_RECEIVE , SD_SEND , SIO_KEEPALIVE_VALS ,
26
- SOCKET_ERROR , SO_PROTOCOL_INFOW , WSABUF , WSAEMSGSIZE , WSAESHUTDOWN , WSAPOLLFD ,
27
- WSAPROTOCOL_INFOW , WSA_FLAG_NO_HANDLE_INHERIT , WSA_FLAG_OVERLAPPED ,
26
+ SOCKET_ERROR , WSABUF , WSAEMSGSIZE , WSAESHUTDOWN , WSAPOLLFD , WSAPROTOCOL_INFOW ,
27
+ WSA_FLAG_NO_HANDLE_INHERIT , WSA_FLAG_OVERLAPPED ,
28
28
} ;
29
29
use windows_sys:: Win32 :: System :: Threading :: INFINITE ;
30
30
31
- use crate :: { MsgHdr , Protocol , RecvFlags , SockAddr , TcpKeepalive , Type } ;
31
+ use crate :: { MsgHdr , RecvFlags , SockAddr , TcpKeepalive , Type } ;
32
32
33
33
#[ allow( non_camel_case_types) ]
34
34
pub ( crate ) type c_int = std:: os:: raw:: c_int ;
@@ -924,13 +924,15 @@ impl crate::Socket {
924
924
/// Returns the [`Protocol`] of this socket by checking the `SO_PROTOCOL_INFOW`
925
925
/// option on this socket.
926
926
#[ cfg( feature = "all" ) ]
927
- pub fn protocol ( & self ) -> io:: Result < Option < Protocol > > {
927
+ pub fn protocol ( & self ) -> io:: Result < Option < crate :: Protocol > > {
928
+ use windows_sys:: Win32 :: Networking :: WinSock :: SO_PROTOCOL_INFOW ;
929
+
928
930
let info = unsafe {
929
931
getsockopt :: < WSAPROTOCOL_INFOW > ( self . as_raw ( ) , SOL_SOCKET , SO_PROTOCOL_INFOW ) ?
930
932
} ;
931
933
match info. iProtocol {
932
934
0 => Ok ( None ) ,
933
- p => Ok ( Some ( Protocol :: from ( p) ) ) ,
935
+ p => Ok ( Some ( crate :: Protocol :: from ( p) ) ) ,
934
936
}
935
937
}
936
938
}
0 commit comments