| 1832 | } |
| 1833 | |
| 1834 | bool call::executeMessage(message *curmsg) |
| 1835 | { |
| 1836 | T_ActionResult actionResult = E_AR_NO_ERROR; |
| 1837 | |
| 1838 | if (curmsg->pause_distribution || curmsg->pause_variable != -1) { |
| 1839 | unsigned int pause; |
| 1840 | if (curmsg->pause_distribution) { |
| 1841 | double actualpause = curmsg->pause_distribution->sample(); |
| 1842 | if (actualpause < 1) { |
| 1843 | // Protect against distribution samples that give |
| 1844 | // negative results (and so pause for ~50 hours when |
| 1845 | // cast to a unsigned int). |
| 1846 | pause = 0; |
| 1847 | } else { |
| 1848 | pause = (unsigned int)actualpause; |
| 1849 | }; |
| 1850 | } else { |
| 1851 | int varId = curmsg->pause_variable; |
| 1852 | pause = (int) M_callVariableTable->getVar(varId)->getDouble(); |
| 1853 | } |
| 1854 | if (pause > INT_MAX) { |
| 1855 | pause = INT_MAX; |
| 1856 | } |
| 1857 | paused_until = clock_tick + pause; |
| 1858 | |
| 1859 | /* This state is used as the last message of a scenario, just for handling |
| 1860 | * final retransmissions. If the connection closes, we do not mark it is |
| 1861 | * failed. */ |
| 1862 | this->timewait = curmsg->timewait; |
| 1863 | |
| 1864 | /* Increment the number of sessions in pause state */ |
| 1865 | curmsg->sessions++; |
| 1866 | do_bookkeeping(curmsg); |
| 1867 | executeAction(nullptr, curmsg); |
| 1868 | callDebug("Pausing call until %d (is now %ld).\n", paused_until, clock_tick); |
| 1869 | setPaused(); |
| 1870 | return true; |
| 1871 | } else if(curmsg -> M_type == MSG_TYPE_SENDCMD) { |
| 1872 | int send_status; |
| 1873 | |
| 1874 | if(next_retrans) { |
| 1875 | return true; |
| 1876 | } |
| 1877 | |
| 1878 | send_status = sendCmdMessage(curmsg); |
| 1879 | |
| 1880 | if(send_status != 0) { /* Send error */ |
| 1881 | return false; /* call deleted */ |
| 1882 | } |
| 1883 | curmsg -> M_nbCmdSent++; |
| 1884 | next_retrans = 0; |
| 1885 | |
| 1886 | do_bookkeeping(curmsg); |
| 1887 | executeAction(nullptr, curmsg); |
| 1888 | return(next()); |
| 1889 | } else if(curmsg -> M_type == MSG_TYPE_NOP) { |
| 1890 | callDebug("Executing NOP at index %d.\n", curmsg->index); |
| 1891 | do_bookkeeping(curmsg); |
nothing calls this directly
no test coverage detected