'rebuild io state based on self.sending() and receiving()'

def _rebuild_io_state(self):

    if (self.socket is None):
        return
    state = 0
    if self.receiving():
        state |= zmq.POLLIN
    if self.sending():
        state |= zmq.POLLOUT
    self._state = state
    self._update_handler(state)
