Return a connection object connected to the pipe given by `address`
(address)
| 748 | _winapi.CloseHandle(handle) |
| 749 | |
| 750 | def PipeClient(address): |
| 751 | ''' |
| 752 | Return a connection object connected to the pipe given by `address` |
| 753 | ''' |
| 754 | t = _init_timeout() |
| 755 | while 1: |
| 756 | try: |
| 757 | _winapi.WaitNamedPipe(address, 1000) |
| 758 | h = _winapi.CreateFile( |
| 759 | address, _winapi.GENERIC_READ | _winapi.GENERIC_WRITE, |
| 760 | 0, _winapi.NULL, _winapi.OPEN_EXISTING, |
| 761 | _winapi.FILE_FLAG_OVERLAPPED, _winapi.NULL |
| 762 | ) |
| 763 | except OSError as e: |
| 764 | if e.winerror not in (_winapi.ERROR_SEM_TIMEOUT, |
| 765 | _winapi.ERROR_PIPE_BUSY) or _check_timeout(t): |
| 766 | raise |
| 767 | else: |
| 768 | break |
| 769 | else: |
| 770 | raise |
| 771 | |
| 772 | _winapi.SetNamedPipeHandleState( |
| 773 | h, _winapi.PIPE_READMODE_MESSAGE, None, None |
| 774 | ) |
| 775 | return PipeConnection(h) |
| 776 | |
| 777 | # |
| 778 | # Authentication stuff |
no test coverage detected
searching dependent graphs…