On 19/08/14 09:07, Juha Heinanen wrote:
Daniel-Constantin Mierla writes:
- Example 1.11. t_precheck_trans usage
+...
- # handle retransmissions
- if(t_precheck_trans()) {
t_check_trans();
exit;
- }
- t_check_trans();
why t_check_trans() is called when t_precheck_trans() returns true? why exit is not enough?
The purpose of t_check_trans() there is for the case when the transaction was already created by another process, resulting in retransmitting back the last reply (what rfc recommends).
Practically, t_precheck_trans() stores the callid/from-tag/cseq/via-branch in a shared memory structure and checks if another process has the same values. It can be the case of a match, but the other process can be ahead with processing and the transaction was created for that request.
I considered of doing t_check_trans() from inside t_precheck_trans(), but then I thought it gives more flexibility via config. t_precheck_trans() should be very fast, these structures are indexed by call id in a hash table, only when a child handles a request with request_route.
If you just want to drop the retransmission, you can skip t_check_trans() inside the if.
Cheers, Daniel