Fix random segfaults due to write into free'd memory

In DhtServer::process_queue(), packet's transaction can be deleted by
failed_transaction(). Yet, the transaction is "cleaned" after that,
which causes write into previously freed memory (possibly into
some other object).
This fix introduces a check that the transaction still exists, and
only modifies an existing transaction.