net-misc/iperf: Move to portage-stable

Local fixes no longer needed on sync with upstream.

Signed-off-by: Geoff Levand <geoff@infradead.org>
This commit is contained in:
Geoff Levand 2015-06-25 15:23:38 -07:00
parent 3076170dda
commit 774222a892
5 changed files with 0 additions and 180 deletions

View File

@ -1 +0,0 @@
DIST iperf-2.0.4.tar.gz 248493 RMD160 b021cc5f2a05465ff04d4b914c94692489e49a9e SHA1 78b6b78789eccf42b5deb783bd8a92469d1383e1 SHA256 3b52f1c178d6a99c27114929d5469c009197d15379c967b329bafb956f397944

View File

@ -1,107 +0,0 @@
Set SO_LINGER on client sockets so that we don't stop timing a
transfer until the server has acked our data. Without this, we end up
stopping timing while data is still in flight and, if there's enough
data in flight, we overreport bandwidth.
diff --git a/include/Client.hpp b/include/Client.hpp
index 1309a00..e1ab11c 100644
--- a/include/Client.hpp
+++ b/include/Client.hpp
@@ -82,6 +82,9 @@ public:
// client connect
void Connect( );
+ // Closes underlying socket
+ void Close( );
+
protected:
thread_Settings *mSettings;
char* mBuf;
diff --git a/src/Client.cpp b/src/Client.cpp
index e0a6950..484a240 100644
--- a/src/Client.cpp
+++ b/src/Client.cpp
@@ -104,13 +104,18 @@ Client::Client( thread_Settings *inSettings ) {
* ------------------------------------------------------------------- */
Client::~Client() {
+ Close();
+ DELETE_ARRAY( mBuf );
+} // end ~Client
+
+void Client::Close() {
if ( mSettings->mSock != INVALID_SOCKET ) {
int rc = close( mSettings->mSock );
WARN_errno( rc == SOCKET_ERROR, "close" );
mSettings->mSock = INVALID_SOCKET;
}
- DELETE_ARRAY( mBuf );
-} // end ~Client
+}
+
const double kSecs_to_usecs = 1e6;
const int kBytes_to_Bits = 8;
@@ -176,6 +181,8 @@ void Client::RunTCP( void ) {
} while ( ! (sInterupted ||
(!mMode_Time && 0 >= mSettings->mAmount)) && canRead );
+ Close();
+
// stop timing
gettimeofday( &(reportstruct->packetTime), NULL );
@@ -193,7 +200,6 @@ void Client::RunTCP( void ) {
/* -------------------------------------------------------------------
* Send data using the connected UDP/TCP socket,
* until a termination flag is reached.
- * Does not close the socket.
* ------------------------------------------------------------------- */
void Client::Run( void ) {
@@ -316,7 +322,9 @@ void Client::Run( void ) {
} while ( ! (sInterupted ||
(mMode_Time && mEndTime.before( reportstruct->packetTime )) ||
(!mMode_Time && 0 >= mSettings->mAmount)) && canRead );
-
+ if (! isUDP( mSettings)) {
+ Close();
+ }
// stop timing
gettimeofday( &(reportstruct->packetTime), NULL );
CloseReport( mSettings->reporthdr, reportstruct );
@@ -422,6 +430,9 @@ void Client::write_UDP_FIN( ) {
fd_set readSet;
struct timeval timeout;
+ FAIL(mSettings->mSock == INVALID_SOCKET,
+ "Closed socket in write_UDP_FIN", mSettings);
+
int count = 0;
while ( count < 10 ) {
count++;
diff --git a/src/PerfSocket.cpp b/src/PerfSocket.cpp
index 3ecdbe0..0a9a27a 100644
--- a/src/PerfSocket.cpp
+++ b/src/PerfSocket.cpp
@@ -152,6 +152,19 @@ void SetSocketOptions( thread_Settings *inSettings ) {
(char*) &nodelay, len );
WARN_errno( rc == SOCKET_ERROR, "setsockopt TCP_NODELAY" );
}
+
+#ifdef SO_LINGER
+ {
+ // Set SO_LINGER so that we don't stop timing before the
+ // far end acks our data.
+ struct linger linger = {1, 360}; // { linger, seconds to linger for}
+ int rc = setsockopt(inSettings->mSock, SOL_SOCKET, SO_LINGER,
+ &linger, sizeof(linger));
+ WARN_errno( rc == SOCKET_ERROR, "setsockopt SO_LINGER");
+ }
+#endif // SO_LINGER
+
+
#endif
}
}

View File

@ -1,6 +0,0 @@
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-misc/iperf/files/iperf.confd,v 1.1 2005/01/23 10:52:13 ka0ttic Exp $
# extra options (run iperf -h for a list of supported options)
IPERF_OPTS="--format Mbytes"

View File

@ -1,21 +0,0 @@
#!/sbin/runscript
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-misc/iperf/files/iperf.initd,v 1.2 2005/01/23 10:52:13 ka0ttic Exp $
depend() {
need net
}
start() {
ebegin "Starting iperf server"
start-stop-daemon --start --quiet \
--exec /usr/bin/iperf -- -s -D ${IPERF_OPTS} &>/dev/null
eend $?
}
stop() {
ebegin "Shutting down iperf server"
start-stop-daemon --stop --quiet --exec /usr/bin/iperf
eend $?
}

View File

@ -1,45 +0,0 @@
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-misc/iperf/iperf-2.0.4.ebuild,v 1.11 2010/01/07 15:48:39 fauli Exp $
inherit eutils
DESCRIPTION="tool to measure IP bandwidth using UDP or TCP"
HOMEPAGE="http://iperf.sourceforge.net/"
SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
LICENSE="as-is"
SLOT="0"
KEYWORDS="amd64 arm hppa ppc ppc64 sparc x86 ~x86-fbsd ~x86-freebsd ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos ~m68k-mint"
IUSE="ipv6 threads debug"
DEPEND=""
RDEPEND=""
src_unpack() {
unpack ${A}
cd "${S}"
epatch "${FILESDIR}"/${PN}-so_linger.patch
}
src_compile() {
econf \
$(use_enable ipv6) \
$(use_enable threads) \
$(use_enable debug debuginfo)
emake || die "emake failed"
}
src_install() {
make DESTDIR="${D}" install || die "make install failed"
dodoc INSTALL README
dohtml doc/*
newinitd "${FILESDIR}"/${PN}.initd ${PN} || die
newconfd "${FILESDIR}"/${PN}.confd ${PN} || die
}
pkg_postinst() {
echo
einfo "To run iperf in server mode, run:"
einfo " /etc/init.d/iperf start"
echo
}