callfork: Fix error propagation

If all fork children fail before any channel can
be created, the fork will always fail with error code
500. However, we can have such a situation because
all participants are offline and the routing returns
the respective error code.

In order to mitigate this, we update the error code
of the call.execute message of the fork. So, in the case
that all children fail before any channel can be established,
the caller will see the error code of the last child.
In an all-offline scenario this would be 404.
This commit is contained in:
Martin Lang 2020-12-08 21:43:27 +01:00 committed by Jakob Haufe
parent 64a0515ea2
commit 63f61805a1
Signed by: sur5r
GPG Key ID: 4CF2B218F54DAE3D
1 changed files with 2 additions and 0 deletions

View File

@ -323,6 +323,8 @@ bool ForkMaster::forkSlave(String* dest)
Debug(this,DebugAll,"Call '%s' target '%s' slave '%s' execute succeeded with no peer [%p]",
getPeerId().c_str(),dest->c_str(),tmp.c_str(),this);
ok = false;
// error propagation via lostMaster() does not work in this case. No channel was created, hence no messages are created
m_exec->setParam("error", error);
slave->lostMaster(error);
}
slave->deref();