1
1

2008-03-12 Jon Dugan <jdugan@x1024.net>

* Added -Wall to CXXFLAGS and CFLAGS.  This generated a lot of noise in the
autotools generated files.

* Added initial AUTHORS file.  This is incomplete, but it's a start.

2008-03-12 Andrew Gallatin <gallatin@gmail.com>

* Rework threading.  This is done by having a condition variable for the reporting
thread rather than using sched_yield and/or usleep.

* Address performance issues on non Linux systems by avoiding system calls
which are expensive on platforms other than Linux.

* Fixes from FreeBSD ports: max_size_t is now 64 bits and not Iperf does not
exit on ENOBUFS.
Этот коммит содержится в:
Jon Dugan 2008-03-12 20:28:21 +00:00
родитель c230011976
Коммит 1efd8f8c50
20 изменённых файлов: 6394 добавлений и 4136 удалений

28
AUTHORS Обычный файл
Просмотреть файл

@ -0,0 +1,28 @@
Mark Gates
Alex Warshavsky
* original authors
Ajay Tirumala
* general improvements
Jim Ferguson <ferguson@ncsa.uiuc.edu>
* Project management
Jon Dugan <jdugan@x1024.net>
* Project maintainer and release coordinator
* various patches and autoconf fixes, general maintenance
Feng Qin
Kevin Gibbs
* windows porting work
John Estabrook <jestabro@ncsa.uiuc.edu>
Andrew Gallatin <gallatin@gmail.com>
* threading fix and non Linux performance improvements

Просмотреть файл

@ -1,3 +1,20 @@
2008-03-12 Jon Dugan <jdugan@x1024.net>
* Added -Wall to CXXFLAGS and CFLAGS. This generated a lot of noise in the
autotools generated files.
* Added initial AUTHORS file. This is incomplete, but it's a start.
2008-03-12 Andrew Gallatin <gallatin@gmail.com>
* Rework threading. This is done by having a condition variable for the reporting
thread rather than using sched_yield and/or usleep.
* Address performance issues on non Linux systems by avoiding system calls
which are expensive on platforms other than Linux.
* Fixes from FreeBSD ports: max_size_t is now 64 bits and not Iperf does not
exit on ENOBUFS.
2007-10-01 JSE <jestabro@ncsa.uiuc.edu>

Просмотреть файл

@ -5,3 +5,5 @@ AM_CPPFLAGS = @STRIP_BEGIN@ \
-I$(top_builddir)/include \
@STRIP_END@
AM_CXXFLAGS = -Wall
AM_FLAGS = -Wall

Просмотреть файл

@ -1,4 +1,4 @@
# Makefile.in generated by automake 1.9.5 from Makefile.am.
# Makefile.in generated by automake 1.9.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@ -37,8 +37,8 @@ build_triplet = @build@
host_triplet = @host@
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/config.h.in \
$(top_srcdir)/configure INSTALL config.guess config.sub \
depcomp install-sh missing
$(top_srcdir)/configure AUTHORS ChangeLog INSTALL config.guess \
config.sub depcomp install-sh missing
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/acx_pthread.m4 \
@ -97,6 +97,7 @@ ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GREP = @GREP@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
@ -130,8 +131,6 @@ WEB100_CONFIG = @WEB100_CONFIG@
WEB100_LIBS = @WEB100_LIBS@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
acx_pthread_config = @acx_pthread_config@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
@ -149,23 +148,30 @@ build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
@ -176,6 +182,8 @@ AM_CPPFLAGS = @STRIP_BEGIN@ \
-I$(top_builddir)/include \
@STRIP_END@
AM_CXXFLAGS = -Wall
AM_FLAGS = -Wall
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive

4
aclocal.m4 поставляемый
Просмотреть файл

@ -1,4 +1,4 @@
# generated automatically by aclocal 1.9.5 -*- Autoconf -*-
# generated automatically by aclocal 1.9.6 -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
# 2005 Free Software Foundation, Inc.
@ -28,7 +28,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"])
# Call AM_AUTOMAKE_VERSION so it can be traced.
# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
[AM_AUTOMAKE_VERSION([1.9.5])])
[AM_AUTOMAKE_VERSION([1.9.6])])
# AM_AUX_DIR_EXPAND -*- Autoconf -*-

Просмотреть файл

@ -5,6 +5,9 @@ AM_CPPFLAGS = @STRIP_BEGIN@ \
-I$(top_builddir)/include \
@STRIP_END@
AM_CXXFLAGS = -Wall
AM_CFLAGS = -Wall
libcompat_a_SOURCES = \
Thread.c \
error.c \

Просмотреть файл

@ -1,4 +1,4 @@
# Makefile.in generated by automake 1.9.5 from Makefile.am.
# Makefile.in generated by automake 1.9.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@ -14,8 +14,6 @@
@SET_MAKE@
SOURCES = $(libcompat_a_SOURCES)
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
@ -100,6 +98,7 @@ ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GREP = @GREP@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
@ -133,8 +132,6 @@ WEB100_CONFIG = @WEB100_CONFIG@
WEB100_LIBS = @WEB100_LIBS@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
acx_pthread_config = @acx_pthread_config@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
@ -152,23 +149,30 @@ build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
@ -179,6 +183,8 @@ AM_CPPFLAGS = @STRIP_BEGIN@ \
-I$(top_builddir)/include \
@STRIP_END@
AM_CXXFLAGS = -Wall
AM_CFLAGS = -Wall
libcompat_a_SOURCES = \
Thread.c \
error.c \

Просмотреть файл

@ -213,22 +213,22 @@
/* Define to the type of arg 5 for `select'. */
#undef SELECT_TYPE_ARG5
/* The size of a `bool', as computed by sizeof. */
/* The size of `bool', as computed by sizeof. */
#undef SIZEOF_BOOL
/* The size of a `char', as computed by sizeof. */
/* The size of `char', as computed by sizeof. */
#undef SIZEOF_CHAR
/* The size of a `int', as computed by sizeof. */
/* The size of `int', as computed by sizeof. */
#undef SIZEOF_INT
/* The size of a `long', as computed by sizeof. */
/* The size of `long', as computed by sizeof. */
#undef SIZEOF_LONG
/* The size of a `short', as computed by sizeof. */
/* The size of `short', as computed by sizeof. */
#undef SIZEOF_SHORT
/* The size of a `void*', as computed by sizeof. */
/* The size of `void*', as computed by sizeof. */
#undef SIZEOF_VOIDP
/* Define to 1 if you have the ANSI C header files. */
@ -268,7 +268,7 @@
/* Define to `int' if <sys/types.h> does not define. */
#undef pid_t
/* Define to `unsigned' if <sys/types.h> does not define. */
/* Define to `unsigned int' if <sys/types.h> does not define. */
#undef size_t
/* Define to "int" if <sys/types.h> does not define. */

10258
configure поставляемый

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,4 +1,4 @@
# Makefile.in generated by automake 1.9.5 from Makefile.am.
# Makefile.in generated by automake 1.9.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@ -73,6 +73,7 @@ ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GREP = @GREP@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
@ -106,8 +107,6 @@ WEB100_CONFIG = @WEB100_CONFIG@
WEB100_LIBS = @WEB100_LIBS@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
acx_pthread_config = @acx_pthread_config@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
@ -125,23 +124,30 @@ build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@

Просмотреть файл

@ -69,6 +69,9 @@ public:
// connects and sends data
void Run( void );
// TCP specific version of above
void RunTCP( void );
void InitiateServer();
// UDP / TCP

Просмотреть файл

@ -1,4 +1,4 @@
# Makefile.in generated by automake 1.9.5 from Makefile.am.
# Makefile.in generated by automake 1.9.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@ -73,6 +73,7 @@ ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GREP = @GREP@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
@ -106,8 +107,6 @@ WEB100_CONFIG = @WEB100_CONFIG@
WEB100_LIBS = @WEB100_LIBS@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
acx_pthread_config = @acx_pthread_config@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
@ -125,23 +124,30 @@ build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@

Просмотреть файл

@ -74,7 +74,7 @@ extern "C" {
*/
typedef struct ReportStruct {
int packetID;
int packetLen;
max_size_t packetLen;
struct timeval packetTime;
struct timeval sentTime;
} ReportStruct;

Просмотреть файл

@ -180,7 +180,7 @@ typedef struct sockaddr_in iperf_sockaddr;
// from the gnu archive
#include <iperf-int.h>
typedef uintmax_t max_size_t;
typedef uint64_t max_size_t;
/* in case the OS doesn't have these, we provide our own implementations */
#include "gettimeofday.h"

Просмотреть файл

@ -115,6 +115,71 @@ Client::~Client() {
const double kSecs_to_usecs = 1e6;
const int kBytes_to_Bits = 8;
void Client::RunTCP( void ) {
long currLen = 0;
struct itimerval it;
max_size_t totLen = 0;
int err;
char* readAt = mBuf;
// Indicates if the stream is readable
bool canRead = true, mMode_Time = isModeTime( mSettings );
ReportStruct *reportstruct = NULL;
// InitReport handles Barrier for multiple Streams
mSettings->reporthdr = InitReport( mSettings );
reportstruct = new ReportStruct;
reportstruct->packetID = 0;
lastPacketTime.setnow();
if ( mMode_Time ) {
memset (&it, 0, sizeof (it));
it.it_value.tv_sec = (int) (mSettings->mAmount / 100.0);
it.it_value.tv_usec = (int) 10000 * (mSettings->mAmount -
it.it_value.tv_sec * 100.0);
err = setitimer( ITIMER_REAL, &it, NULL );
if ( err != 0 ) {
perror("setitimer");
exit(1);
}
}
do {
// Read the next data block from
// the file if it's file input
if ( isFileInput( mSettings ) ) {
Extractor_getNextDataBlock( readAt, mSettings );
canRead = Extractor_canRead( mSettings ) != 0;
} else
canRead = true;
// perform write
currLen = write( mSettings->mSock, mBuf, mSettings->mBufLen );
if ( currLen < 0 ) {
WARN_errno( currLen < 0, "write2" );
break;
}
totLen += currLen;
if ( !mMode_Time ) {
mSettings->mAmount -= currLen;
}
} while ( ! (sInterupted ||
(!mMode_Time && 0 >= mSettings->mAmount)) && canRead );
// stop timing
gettimeofday( &(reportstruct->packetTime), NULL );
reportstruct->packetLen = totLen;
ReportPacket( mSettings->reporthdr, reportstruct );
CloseReport( mSettings->reporthdr, reportstruct );
DELETE_PTR( reportstruct );
EndReport( mSettings->reporthdr );
}
/* -------------------------------------------------------------------
* Send data using the connected UDP/TCP socket,
* until a termination flag is reached.
@ -130,6 +195,13 @@ void Client::Run( void ) {
int adjust = 0;
char* readAt = mBuf;
#if HAVE_THREAD
if ( !isUDP( mSettings ) ) {
RunTCP();
return;
}
#endif
// Indicates if the stream is readable
bool canRead = true, mMode_Time = isModeTime( mSettings );
@ -215,7 +287,7 @@ void Client::Run( void ) {
// perform write
currLen = write( mSettings->mSock, mBuf, mSettings->mBufLen );
if ( currLen < 0 ) {
if ( currLen < 0 && errno != ENOBUFS ) {
WARN_errno( currLen < 0, "write2" );
break;
}

Просмотреть файл

@ -9,6 +9,9 @@ AM_CPPFLAGS = @STRIP_BEGIN@ \
-I$(top_builddir)/include \
@STRIP_END@
AM_CXXFLAGS = -Wall
AM_CFLAGS = -Wall
iperf_LDFLAGS = @CFLAGS@ @PTHREAD_CFLAGS@ @WEB100_CFLAGS@ @DEFS@
iperf_SOURCES = \

Просмотреть файл

@ -1,4 +1,4 @@
# Makefile.in generated by automake 1.9.5 from Makefile.am.
# Makefile.in generated by automake 1.9.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@ -14,8 +14,6 @@
@SET_MAKE@
SOURCES = $(iperf_SOURCES)
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
@ -104,6 +102,7 @@ ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GREP = @GREP@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
@ -137,8 +136,6 @@ WEB100_CONFIG = @WEB100_CONFIG@
WEB100_LIBS = @WEB100_LIBS@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
acx_pthread_config = @acx_pthread_config@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
@ -156,23 +153,30 @@ build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
@ -186,6 +190,8 @@ AM_CPPFLAGS = @STRIP_BEGIN@ \
-I$(top_builddir)/include \
@STRIP_END@
AM_CXXFLAGS = -Wall
AM_CFLAGS = -Wall
iperf_LDFLAGS = @CFLAGS@ @PTHREAD_CFLAGS@ @WEB100_CFLAGS@ @DEFS@
iperf_SOURCES = \
Client.cpp \

Просмотреть файл

@ -110,6 +110,8 @@ report_statistics multiple_reports[kReport_MAXIMUM] = {
char buffer[64]; // Buffer for printing
ReportHeader *ReportRoot = NULL;
int threadWait = 0;
int threadSleeping = 0;
extern Condition ReportCond;
int reporter_process_report ( ReportHeader *report );
void process_report ( ReportHeader *report );
@ -349,7 +351,9 @@ void ReportPacket( ReportHeader* agent, ReportStruct *packet ) {
thread_rest();
index = agent->reporterindex;
}
if (threadSleeping)
Condition_Signal( &ReportCond );
// Put the information there
memcpy( agent->data + agent->agentindex, packet, sizeof(ReportStruct) );
@ -378,6 +382,9 @@ void CloseReport( ReportHeader *agent, ReportStruct *packet ) {
packet->packetLen = 0;
ReportPacket( agent, packet );
packet->packetID = agent->report.cntDatagrams;
if (threadSleeping)
Condition_Signal( &ReportCond );
}
}
@ -389,6 +396,9 @@ void CloseReport( ReportHeader *agent, ReportStruct *packet ) {
void EndReport( ReportHeader *agent ) {
if ( agent != NULL ) {
int index = agent->reporterindex;
if (threadSleeping)
Condition_Signal( &ReportCond );
while ( index != -1 ) {
thread_rest();
index = agent->reporterindex;
@ -457,6 +467,10 @@ void ReportSettings( thread_Settings *agent ) {
* Update the ReportRoot to include this report.
*/
Condition_Lock( ReportCond );
if ( isUDP(agent) )
threadWait = 0;
else
threadWait = 1;
reporthdr->next = ReportRoot;
ReportRoot = reporthdr;
Condition_Signal( &ReportCond );
@ -577,7 +591,17 @@ void reporter_spawn( thread_Settings *thread ) {
Condition_Unlock ( ReportCond );
}
// yield control of CPU is another thread is waiting
thread_rest();
// sleep on a condition variable, as it is much cheaper
// on most platforms than issuing schedyield or usleep
// syscalls
Condition_Lock ( ReportCond );
if ( threadWait && ReportRoot != NULL) {
threadSleeping = 1;
Condition_TimedWait (& ReportCond, 1 );
threadSleeping = 0;
}
Condition_Unlock ( ReportCond );
} else {
//Condition_Unlock ( ReportCond );
}

Просмотреть файл

@ -98,6 +98,7 @@ void Server::Sig_Int( int inSigno ) {
* ------------------------------------------------------------------- */
void Server::Run( void ) {
long currLen;
max_size_t totLen = 0;
struct UDP_datagram* mBuf_UDP = (struct UDP_datagram*) mBuf;
ReportStruct *reportstruct = NULL;
@ -115,10 +116,11 @@ void Server::Run( void ) {
reportstruct->packetID = ntohl( mBuf_UDP->id );
reportstruct->sentTime.tv_sec = ntohl( mBuf_UDP->tv_sec );
reportstruct->sentTime.tv_usec = ntohl( mBuf_UDP->tv_usec );
}
reportstruct->packetLen = currLen;
gettimeofday( &(reportstruct->packetTime), NULL );
reportstruct->packetLen = currLen;
gettimeofday( &(reportstruct->packetTime), NULL );
} else {
totLen += currLen;
}
// terminate when datagram begins with negative index
// the datagram ID should be correct, just negated
@ -126,11 +128,16 @@ void Server::Run( void ) {
reportstruct->packetID = -reportstruct->packetID;
currLen = -1;
}
ReportPacket( mSettings->reporthdr, reportstruct );
if ( isUDP (mSettings))
ReportPacket( mSettings->reporthdr, reportstruct );
} while ( currLen > 0 );
// stop timing
gettimeofday( &(reportstruct->packetTime), NULL );
if ( !isUDP (mSettings)) {
reportstruct->packetLen = totLen;
ReportPacket( mSettings->reporthdr, reportstruct );
}
CloseReport( mSettings->reporthdr, reportstruct );
// send a acknowledgement back only if we're NOT receiving multicast

Просмотреть файл

@ -123,6 +123,7 @@ int main( int argc, char **argv ) {
// Set SIGTERM and SIGINT to call our user interrupt function
my_signal( SIGTERM, Sig_Interupt );
my_signal( SIGINT, Sig_Interupt );
my_signal( SIGALRM, Sig_Interupt );
#ifndef WIN32
// Ignore broken pipes