connection: simplify reply cleanups
authorDavid Herrmann <dh.herrmann@gmail.com>
Thu, 23 Oct 2014 10:16:25 +0000 (12:16 +0200)
committerDavid Herrmann <dh.herrmann@gmail.com>
Thu, 23 Oct 2014 10:16:25 +0000 (12:16 +0200)
commita8adec5ddeb21dae91bab180abf3e2dc879f9102
tree13a153904a498a4d59e24a6619c4506696cff81f
parentaa81005e886a6d3f29645053f90d8bf56faca4c4
connection: simplify reply cleanups

There is no reason why we cannot destroy replies while holding a
connection lock. If the reply points to the connection whose lock we hold,
we also have another ref on that connection due to our context. If the
lock points to another connection, we can simply unref it at any time.

Note that we never cause disconnects on the connection. We only unref it!
The object destruction is a simple memory cleanup. Nothing fancy is done
there, and no inter-object refs can exist anymore (otherwise, it would not
get freed). Therefore, fix all our callers to free replies directly,
instead of releasing the locks first.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
connection.c