Do not crash when closing both client and upstream

This commit is contained in:
Ondřej Kuzník 2017-07-13 17:08:50 +01:00 committed by Ondřej Kuzník
parent 532fc1bf98
commit 362d550328

View file

@ -581,6 +581,15 @@ operation_abandon( Operation *op )
CONNECTION_LOCK_DECREF(c);
unlock:
/*
* FIXME: the dance in operation_destroy_from_upstream might be slower than
* optimal as we've done some of the things above already. However, we want
* to clear o_upstream from the op if it's dying, but witnessing and
* navigating the race to do that safely is too complex to copy here.
*/
if ( !c->c_live ) {
operation_destroy_from_upstream( op );
}
UPSTREAM_UNLOCK_OR_DESTROY(c);
done: