Merge branch 'Bugfix-sigint-time-error' into 'master'
修复 #2 提及的时间结果错误问题,在SIGINT信号处理函数中增加结束时间计算 See merge request common_tools/tcp_burst!4
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1 +1,2 @@
|
|||||||
tcpburst
|
tcpburst
|
||||||
|
.vscode
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
@@ -76,6 +77,8 @@ break_now(int signo)
|
|||||||
kill(tcpdump.pid, SIGKILL);
|
kill(tcpdump.pid, SIGKILL);
|
||||||
#endif
|
#endif
|
||||||
*/
|
*/
|
||||||
|
if (gettimeofday(&end, NULL) < 0)
|
||||||
|
errx(-1, "gettimeofday() failed: %s", strerror(errno));
|
||||||
packet_stats(&begin, &end, bytes_sent, pkts_sent, failed);
|
packet_stats(&begin, &end, bytes_sent, pkts_sent, failed);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user