static int on_stream_packet(DnsStream *s) {
        _cleanup_(dns_packet_unrefp) DnsPacket *p = NULL;
        DnsTransaction *t;

        assert(s);

        /* Take ownership of packet to be able to receive new packets */
        p = dns_stream_take_read_packet(s);
        assert(p);

        t = hashmap_get(s->manager->dns_transactions, UINT_TO_PTR(DNS_PACKET_ID(p)));
        if (t)
                return dns_transaction_on_stream_packet(t, p);

        /* Ignore incorrect transaction id as transaction can have been canceled */
        if (dns_packet_validate_reply(p) <= 0) {
                log_debug("Invalid TCP reply packet.");
                on_stream_complete(s, 0);
        }

        return 0;
}
static int on_stream_packet(DnsStream *s) {
        _cleanup_(dns_packet_unrefp) DnsPacket *p = NULL;
        DnsTransaction *t;

        assert(s);

         
        p = dns_stream_take_read_packet(s);
        assert(p);

        t = hashmap_get(s->manager->dns_transactions, UINT_TO_PTR(DNS_PACKET_ID(p)));
        if (t)
                return dns_transaction_on_stream_packet(t, p);

         
        if (dns_packet_validate_reply(p) <= 0) {
                log_debug("Invalid TCP reply packet.");
                on_stream_complete(s, 0);
        }

        return 0;
}