@@ -32,7 +32,7 @@ def close(self):
32
32
in the same way
33
33
"""
34
34
if self ._handle is not None :
35
- win32file . CloseHandle (self ._handle )
35
+ win32pipe . DisconnectNamedPipe (self ._handle )
36
36
self ._handle = None
37
37
38
38
@@ -67,10 +67,13 @@ def open(self):
67
67
while conns < self ._max_conn_attempts :
68
68
try :
69
69
h = win32file .CreateFile (
70
- self ._pipe_name ,
71
- win32file .GENERIC_READ | win32file .GENERIC_WRITE , 0 , None ,
72
- win32file .OPEN_EXISTING , win32file .FILE_FLAG_OVERLAPPED ,
73
- None )
70
+ self ._pipe_name ,
71
+ win32file .GENERIC_READ | win32file .GENERIC_WRITE ,
72
+ 0 ,
73
+ None ,
74
+ win32file .OPEN_EXISTING ,
75
+ win32file .FILE_FLAG_OVERLAPPED ,
76
+ None )
74
77
except pywintypes .error as e :
75
78
if e .winerror != winerror .ERROR_PIPE_BUSY :
76
79
raise TTransportException (
@@ -195,8 +198,8 @@ def create_named_pipe(self):
195
198
196
199
self ._handle = win32pipe .CreateNamedPipe (
197
200
self ._pipe_name , openMode , pipeMode ,
198
- win32pipe .PIPE_UNLIMITED_INSTANCES , self ._buff_size ,
199
- self . _buff_size , win32pipe .NMPWAIT_WAIT_FOREVER , saAttr )
201
+ win32pipe .PIPE_UNLIMITED_INSTANCES , self ._buff_size , self . _buff_size ,
202
+ win32pipe .NMPWAIT_WAIT_FOREVER , saAttr )
200
203
201
204
err = win32api .GetLastError ()
202
205
if self ._handle .handle == winerror .ERROR_INVALID_HANDLE :
@@ -220,13 +223,3 @@ def initiate_named_connect(self):
220
223
if ret == winerror .ERROR_PIPE_CONNECTED :
221
224
win32event .SetEvent (self ._overlapped .hEvent )
222
225
break
223
-
224
- def close (self ):
225
- """
226
- The server must ensure to disconnect so that subsequent reconnect
227
- attempts are successful
228
- """
229
- if self ._handle is not None :
230
- win32pipe .DisconnectNamedPipe (self ._handle )
231
- win32file .CloseHandle (self ._handle )
232
- self ._handle = None
0 commit comments