}
+ /* IO might take time, increase timeout of WD */
+ TrexMonitor * cur_monitor = TrexWatchDog::getInstance().get_current_monitor();
+ if (cur_monitor != NULL) {
+ cur_monitor->io_begin();
+ }
+
try {
port->push_remote(pcap_filename, ipg_usec, min_ipg_sec, speedup, count, duration, is_dual);
} catch (const TrexException &ex) {
generate_execute_err(result, ex.what());
}
+ /* revert timeout of WD */
+ if (cur_monitor != NULL) {
+ cur_monitor->io_end();
+ }
+
result["result"] = Json::objectValue;
return (TREX_RPC_CMD_OK);
m_dir = dir;
m_min_ipg_sec = min_ipg_sec;
+ /* increase timeout of WD due to io */
+ TrexMonitor * cur_monitor = TrexWatchDog::getInstance().get_current_monitor();
+ if (cur_monitor != NULL) {
+ cur_monitor->io_begin();
+ }
+
/* mark this node as slow path */
set_slow_path(true);
m_reader = NULL;
}
+ /* end of io, return normal timeout of WD */
+ TrexMonitor * cur_monitor = TrexWatchDog::getInstance().get_current_monitor();
+ if (cur_monitor != NULL) {
+ cur_monitor->io_end();
+ }
+
m_state = PCAP_INVALID;
}
*
*/
TrexMonitor * TrexWatchDog::get_current_monitor() {
- TrexMonitor * cur_monitor = NULL;
for (int i = 0; i < m_mon_count; i++) {
if ( m_monitors[i]->get_tid() == pthread_self() ) {
- cur_monitor = m_monitors[i];
- break;
+ return m_monitors[i];
}
}
- return cur_monitor;
+ return NULL;
}