@Override
    protected boolean xhas_in ()
    {
        //  If we are in the middle of reading the messages, there are
        //  definitely more parts available.
        if (more_in)
            return true;

        //  We may already have a message pre-fetched.
        if (prefetched)
            return true;

        //  Try to read the next message.
        //  The message, if read, is kept in the pre-fetch buffer.
        Pipe[] pipe = new Pipe[1];
        prefetched_msg = fq.recvpipe (pipe);

        //  It's possible that we receive peer's identity. That happens
        //  after reconnection. The current implementation assumes that
        //  the peer always uses the same identity.
        //  TODO: handle the situation when the peer changes its identity.
        while (prefetched_msg != null && prefetched_msg.is_identity ())
            prefetched_msg = fq.recvpipe (pipe);

        if (prefetched_msg == null)
            return false;

        assert (pipe[0] != null);
        
        Blob identity = pipe[0].get_identity ();
        prefetched_id = new Msg(identity.data());
        prefetched_id.set_flags (Msg.more);

        prefetched = true;
        identity_sent = false;

        return true;
    }