MCPcopy Create free account
hub / github.com/SIPp/sipp / next

Method next

src/call.cpp:1802–1832  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1800}
1801
1802bool call::next()
1803{
1804 msgvec * msgs = &call_scenario->messages;
1805 if (initCall) {
1806 msgs = &call_scenario->initmessages;
1807 }
1808
1809 int test;
1810 /* What is the next message index? */
1811 /* Default without branching: use the next message */
1812 int new_msg_index = msg_index + 1;
1813 /* If branch needed, overwrite this default */
1814 if (msg_index >= 0 && ((*msgs)[msg_index]->next >= 0) &&
1815 (((test = ((*msgs)[msg_index]->test)) == -1) ||
1816 M_callVariableTable->getVar(test)->isSet())) {
1817 /* Branching possible, check the probability */
1818 int chance = (*msgs)[msg_index]->chance;
1819 if ((chance <= 0) || (rand() > chance )) {
1820 /* Branch == overwrite with the 'next' attribute value */
1821 new_msg_index = (*msgs)[msg_index]->next;
1822 }
1823 }
1824 msg_index = new_msg_index;
1825 recv_timeout = 0;
1826 if (msg_index >= (int)((*msgs).size())) {
1827 terminate(CStat::E_CALL_SUCCESSFULLY_ENDED);
1828 return false;
1829 }
1830
1831 return true;
1832}
1833
1834bool call::executeMessage(message *curmsg)
1835{

Callers

nothing calls this directly

Calls 3

isSetMethod · 0.80
getVarMethod · 0.80
sizeMethod · 0.80

Tested by

no test coverage detected