# Path: opendiamond/helpers.py
# def daemonize():
# def signalname(signum):
# def murmur(data):
#     def __init__(self):
#     def __call__(self, service, address):
#     def __init__(self, error):
#     def __call__(self, service, address):
# def split_scheme(url):
# class _TcpWrappers(object):
# class _DummyTcpWrappers(object):
# 
# Path: opendiamond/protocol.py
# NONCE_LEN = 16
# 
# NULL_NONCE = b'\x00' * NONCE_LEN


from builtins import object
from weakref import WeakValueDictionary
from opendiamond.helpers import connection_ok
from opendiamond.protocol import NONCE_LEN, NULL_NONCE
import binascii
import errno
import logging
import os
import select
import socket
        fd = pconn.sock.fileno()
        self._fd_to_pconn[fd] = pconn
        self._pollset.register(fd, mask)

    def unregister(self, pconn):
        '''Remove the pconn from the set.'''
        fd = pconn.sock.fileno()
        self._pollset.unregister(fd)
        del self._fd_to_pconn[fd]

    def poll(self):
        '''Poll for events and return a list of (pconn, eventmask) pairs.
        pconn will be None for events on the listening socket.'''
        while True:
            try:
                items = self._pollset.poll()
            except select.error as e:
                # If poll() was interrupted by a signal, retry.  If the
                # signal was supposed to be fatal, the signal handler would
                # have raised an exception.
                if e.args[0] == errno.EINTR:
                    pass
                else:
                    raise
            else:
                break

        ret = []
        for fd, event in items:
            ret.append((self._fd_to_pconn[fd], event))

# Path: opendiamond/helpers.py
# def daemonize():
# def signalname(signum):
# def murmur(data):
#     def __init__(self):
#     def __call__(self, service, address):
#     def __init__(self, error):
#     def __call__(self, service, address):
# def split_scheme(url):
# class _TcpWrappers(object):
# class _DummyTcpWrappers(object):
# 
# Path: opendiamond/protocol.py
# NONCE_LEN = 16
# 
# NULL_NONCE = b'\x00' * NONCE_LEN


# Path: opendiamond/server/listen.py
from builtins import object
from weakref import WeakValueDictionary
from opendiamond.helpers import connection_ok
from opendiamond.protocol import NONCE_LEN, NULL_NONCE
import binascii
import errno
import logging
import os
import select
import socket

        fd = pconn.sock.fileno()
        self._fd_to_pconn[fd] = pconn
        self._pollset.register(fd, mask)

    def unregister(self, pconn):
        '''Remove the pconn from the set.'''
        fd = pconn.sock.fileno()
        self._pollset.unregister(fd)
        del self._fd_to_pconn[fd]

    def poll(self):
        '''Poll for events and return a list of (pconn, eventmask) pairs.
        pconn will be None for events on the listening socket.'''
        while True:
            try:
                items = self._pollset.poll()
            except select.error as e:
                # If poll() was interrupted by a signal, retry.  If the
                # signal was supposed to be fatal, the signal handler would
                # have raised an exception.
                if e.args[0] == errno.EINTR:
                    pass
                else:
                    raise
            else:
                break

        ret = []
        for fd, event in items:
            ret.append((self._fd_to_pconn[fd], event))

        return ret