Esempio n. 1
0
def _reset(obj):
    global _lock, _listener, _cache
    for h in _cache:
        close(h)
    _cache.clear()
    _lock = threading.Lock()
    _listener = None
Esempio n. 2
0
def _reset(obj):
    global _lock, _listener, _cache
    for h in _cache:
        close(h)
    _cache.clear()
    _lock = threading.Lock()
    _listener = None
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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
                    )
Esempio n. 7
0
 def _finalize_pipe_listener(queue, address):
     sub_debug('closing listener with address=%r', address)
     for handle in queue:
         close(handle)
Esempio n. 8
0
 def _finalize_pipe_listener(queue, address):
     sub_debug('closing listener with address=%r', address)
     for handle in queue:
         close(handle)
Esempio n. 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
Esempio n. 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