调整回放包逻辑,仅当使用marsio编译且使用marsio模式回放流量时,启用marsio_thread
This commit is contained in:
21
.gitignore
vendored
21
.gitignore
vendored
@@ -4,3 +4,24 @@ tcpburst
|
|||||||
GPATH
|
GPATH
|
||||||
GRTAGS
|
GRTAGS
|
||||||
GTAGS
|
GTAGS
|
||||||
|
*.o
|
||||||
|
*.Po
|
||||||
|
*.a
|
||||||
|
Makefile
|
||||||
|
test/config
|
||||||
|
src/tcprewrite
|
||||||
|
src/tcpreplay-edit
|
||||||
|
src/tcpprep
|
||||||
|
src/tcpreplay
|
||||||
|
src/tcpbridge
|
||||||
|
src/stamp-h1
|
||||||
|
src/defines.h
|
||||||
|
src/config.h
|
||||||
|
libopts/.libs/libopts.la
|
||||||
|
libopts/.deps/libopts_la-libopts.Plo
|
||||||
|
libopts/libopts.la
|
||||||
|
libopts/libopts_la-libopts.lo
|
||||||
|
libtool
|
||||||
|
doxygen.cfg
|
||||||
|
config.status
|
||||||
|
config.log
|
||||||
|
|||||||
@@ -1639,7 +1639,7 @@ static void *replay_files_thread(void *arg)
|
|||||||
marsio_thread_init(tcpburst_marsio4_instance);
|
marsio_thread_init(tcpburst_marsio4_instance);
|
||||||
|
|
||||||
if(0 == loop){
|
if(0 == loop){
|
||||||
loop = 1; /* 至少一次 */
|
while(1)replay_file(0);
|
||||||
}
|
}
|
||||||
for(i = 0; i < loop; i++){
|
for(i = 0; i < loop; i++){
|
||||||
replay_file(0);
|
replay_file(0);
|
||||||
@@ -1748,6 +1748,19 @@ main(int argc, char *argv[])
|
|||||||
if (gettimeofday(&begin, NULL) < 0)
|
if (gettimeofday(&begin, NULL) < 0)
|
||||||
errx(-1, "gettimeofday() failed: %s", strerror(errno));
|
errx(-1, "gettimeofday() failed: %s", strerror(errno));
|
||||||
|
|
||||||
|
|
||||||
|
if (12 == send_pkt_driver_mode)
|
||||||
|
{
|
||||||
|
#ifdef MARSIO
|
||||||
|
pthread_t pid;
|
||||||
|
pthread_create(&pid, NULL, replay_files_thread, (void *)options.loop);
|
||||||
|
pthread_join(pid, NULL);
|
||||||
|
#else
|
||||||
|
errx(-1, "send_pkt_driver_mode == %s, but tcp_burst did not compiled with %s", "MARSIO", "MARSIO");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
/* main loop for non-bridge mode */
|
/* main loop for non-bridge mode */
|
||||||
if (options.loop > 0) {
|
if (options.loop > 0) {
|
||||||
while (options.loop--) { /* limited loop */
|
while (options.loop--) { /* limited loop */
|
||||||
@@ -1756,18 +1769,8 @@ main(int argc, char *argv[])
|
|||||||
/* reset cache markers for each iteration */
|
/* reset cache markers for each iteration */
|
||||||
cache_byte = 0;
|
cache_byte = 0;
|
||||||
cache_bit = 0;
|
cache_bit = 0;
|
||||||
#ifdef MARSIO
|
|
||||||
if(12 == send_pkt_driver_mode){
|
|
||||||
pthread_t pid;
|
|
||||||
pthread_create(&pid, NULL, replay_files_thread, (void *)options.loop);
|
|
||||||
pthread_join(pid, NULL);
|
|
||||||
}else{
|
|
||||||
replay_file(i);
|
replay_file(i);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
replay_file(i);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -1777,21 +1780,11 @@ main(int argc, char *argv[])
|
|||||||
/* reset cache markers for each iteration */
|
/* reset cache markers for each iteration */
|
||||||
cache_byte = 0;
|
cache_byte = 0;
|
||||||
cache_bit = 0;
|
cache_bit = 0;
|
||||||
#ifdef MARSIO
|
|
||||||
if(12 == send_pkt_driver_mode){
|
|
||||||
pthread_t pid;
|
|
||||||
pthread_create(&pid, NULL, replay_files_thread, (void *)options.loop);
|
|
||||||
pthread_join(pid, NULL);
|
|
||||||
}else{
|
|
||||||
replay_file(i);
|
replay_file(i);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
replay_file(i);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bytes_sent > 0) {
|
if (bytes_sent > 0) {
|
||||||
if (gettimeofday(&end, NULL) < 0)
|
if (gettimeofday(&end, NULL) < 0)
|
||||||
errx(-1, "Unable to gettimeofday(): %s", strerror(errno));
|
errx(-1, "Unable to gettimeofday(): %s", strerror(errno));
|
||||||
|
|||||||
Reference in New Issue
Block a user