File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change 1
1
import functools
2
+ import time
2
3
import io
3
4
4
5
import six
9
10
cSECURITY_SQOS_PRESENT = 0x100000
10
11
cSECURITY_ANONYMOUS = 0
11
12
12
- RETRY_WAIT_TIMEOUT = 10000
13
+ MAXIMUM_RETRY_COUNT = 10
13
14
14
15
15
16
def check_closed (f ):
@@ -46,8 +47,7 @@ def close(self):
46
47
self ._closed = True
47
48
48
49
@check_closed
49
- def connect (self , address ):
50
- win32pipe .WaitNamedPipe (address , self ._timeout )
50
+ def connect (self , address , retry_count = 0 ):
51
51
try :
52
52
handle = win32file .CreateFile (
53
53
address ,
@@ -65,8 +65,10 @@ def connect(self, address):
65
65
# Another program or thread has grabbed our pipe instance
66
66
# before we got to it. Wait for availability and attempt to
67
67
# connect again.
68
- win32pipe .WaitNamedPipe (address , RETRY_WAIT_TIMEOUT )
69
- return self .connect (address )
68
+ retry_count = retry_count + 1
69
+ if (retry_count < MAXIMUM_RETRY_COUNT ):
70
+ time .sleep (1 )
71
+ return self .connect (address , retry_count )
70
72
raise e
71
73
72
74
self .flags = win32pipe .GetNamedPipeInfo (handle )[0 ]
You can’t perform that action at this time.
0 commit comments