Example #1
0
def _reset(obj):
    global _lock, _listener, _cache
    for h in _cache:
        close(h)
    _cache.clear()
    _lock = threading.Lock()
    _listener = None
Example #2
0
def _reset(obj):
    global _lock, _listener, _cache
    for h in _cache:
        close(h)
    _cache.clear()
    _lock = threading.Lock()
    _listener = None
Example #3
0
 def send_handle(conn, handle, destination_pid):
     process_handle = win32.OpenProcess(win32.PROCESS_ALL_ACCESS, False,
                                        destination_pid)
     try:
         new_handle = duplicate(handle, process_handle)
         conn.send(new_handle)
     finally:
         close(process_handle)
Example #4
0
 def send_handle(conn, handle, destination_pid):
     process_handle = win32.OpenProcess(
         win32.PROCESS_ALL_ACCESS, False, destination_pid
         )
     try:
         new_handle = duplicate(handle, process_handle)
         conn.send(new_handle)
     finally:
         close(process_handle)
Example #5
0
def _serve():
    from .util import is_exiting, sub_warning

    while 1:
        try:
            conn = _listener.accept()
            handle_wanted, destination_pid = conn.recv()
            _cache.remove(handle_wanted)
            send_handle(conn, handle_wanted, destination_pid)
            close(handle_wanted)
            conn.close()
        except:
            if not is_exiting():
                import traceback
                sub_warning('thread for sharing handles raised exception :\n' +
                            '-' * 79 + '\n' + traceback.format_exc() +
                            '-' * 79)
Example #6
0
def _serve():
    from .util import is_exiting, sub_warning

    while 1:
        try:
            conn = _listener.accept()
            handle_wanted, destination_pid = conn.recv()
            _cache.remove(handle_wanted)
            send_handle(conn, handle_wanted, destination_pid)
            close(handle_wanted)
            conn.close()
        except:
            if not is_exiting():
                import traceback
                sub_warning(
                    'thread for sharing handles raised exception :\n' +
                    '-'*79 + '\n' + traceback.format_exc() + '-'*79
                    )
Example #7
0
 def _finalize_pipe_listener(queue, address):
     sub_debug('closing listener with address=%r', address)
     for handle in queue:
         close(handle)
Example #8
0
 def _finalize_pipe_listener(queue, address):
     sub_debug('closing listener with address=%r', address)
     for handle in queue:
         close(handle)
Example #9
0
def rebuild_socket(reduced_handle, family, type_, proto):
    fd = rebuild_handle(reduced_handle)
    _sock = fromfd(fd, family, type_, proto)
    close(fd)
    return _sock
Example #10
0
def rebuild_socket(reduced_handle, family, type_, proto):
    fd = rebuild_handle(reduced_handle)
    _sock = fromfd(fd, family, type_, proto)
    close(fd)
    return _sock