@@ -1701,14 +1701,18 @@ impl ServerOptions {
17011701 /// The default pipe mode is [`PipeMode::Byte`]. See [`PipeMode`] for
17021702 /// documentation of what each mode means.
17031703 ///
1704- /// This corresponding to specifying [`dwPipeMode`].
1704+ /// This corresponds to specifying `PIPE_TYPE_` and `PIPE_READMODE_` in [`dwPipeMode`].
17051705 ///
17061706 /// [`dwPipeMode`]: https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-createnamedpipea
17071707 pub fn pipe_mode ( & mut self , pipe_mode : PipeMode ) -> & mut Self {
17081708 let is_msg = matches ! ( pipe_mode, PipeMode :: Message ) ;
17091709 // Pipe mode is implemented as a bit flag 0x4. Set is message and unset
17101710 // is byte.
1711- bool_flag ! ( self . pipe_mode, is_msg, windows_sys:: PIPE_TYPE_MESSAGE ) ;
1711+ bool_flag ! (
1712+ self . pipe_mode,
1713+ is_msg,
1714+ windows_sys:: PIPE_TYPE_MESSAGE | windows_sys:: PIPE_READMODE_MESSAGE
1715+ ) ;
17121716 self
17131717 }
17141718
@@ -2556,7 +2560,7 @@ unsafe fn named_pipe_info(handle: RawHandle) -> io::Result<PipeInfo> {
25562560
25572561#[ cfg( test) ]
25582562mod test {
2559- use self :: windows_sys:: { PIPE_REJECT_REMOTE_CLIENTS , PIPE_TYPE_BYTE , PIPE_TYPE_MESSAGE } ;
2563+ use self :: windows_sys:: { PIPE_REJECT_REMOTE_CLIENTS , PIPE_TYPE_BYTE , PIPE_TYPE_MESSAGE , PIPE_READMODE_MESSAGE } ;
25602564 use super :: * ;
25612565
25622566 #[ test]
@@ -2588,13 +2592,13 @@ mod test {
25882592
25892593 opts. reject_remote_clients ( false ) ;
25902594 opts. pipe_mode ( PipeMode :: Message ) ;
2591- assert_eq ! ( opts. pipe_mode, PIPE_TYPE_MESSAGE ) ;
2595+ assert_eq ! ( opts. pipe_mode, PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE ) ;
25922596
25932597 opts. reject_remote_clients ( true ) ;
25942598 opts. pipe_mode ( PipeMode :: Message ) ;
25952599 assert_eq ! (
25962600 opts. pipe_mode,
2597- PIPE_TYPE_MESSAGE | PIPE_REJECT_REMOTE_CLIENTS
2601+ PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_REJECT_REMOTE_CLIENTS
25982602 ) ;
25992603 }
26002604}
0 commit comments