bump(main/iperf3): 3.16

This commit is contained in:
tqfx 2024-04-23 10:36:15 +08:00 committed by Twaik Yont
parent 55869e3a08
commit 277f67a7ad
2 changed files with 125 additions and 3 deletions

View File

@ -2,9 +2,11 @@ TERMUX_PKG_HOMEPAGE=https://github.com/esnet/iperf
TERMUX_PKG_DESCRIPTION="TCP, UDP, and SCTP network bandwidth measurement tool"
TERMUX_PKG_LICENSE="BSD 3-Clause"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=3.15
TERMUX_PKG_SRCURL=https://fossies.org/linux/privat/iperf-$TERMUX_PKG_VERSION.tar.gz
TERMUX_PKG_SHA256=bdb77c11f72bce90214883159577fa24412013e62b2083cf5f54391d79b1d8ff
TERMUX_PKG_VERSION=3.16
TERMUX_PKG_SRCURL=https://github.com/esnet/iperf/releases/download/$TERMUX_PKG_VERSION/iperf-$TERMUX_PKG_VERSION.tar.gz
TERMUX_PKG_SHA256=cc740c6bbea104398cc3e466befc515a25896ec85e44a662d5f4a767b9cf713e
TERMUX_PKG_UPDATE_VERSION_REGEXP="\d+\.\d+"
TERMUX_PKG_AUTO_UPDATE=true
TERMUX_PKG_DEPENDS="openssl"
TERMUX_PKG_BREAKS="iperf3-dev"
TERMUX_PKG_REPLACES="iperf3-dev"

View File

@ -0,0 +1,120 @@
--- a/src/iperf_client_api.c 2024-04-23 02:39:41.293234343 +0000
+++ b/src/iperf_client_api.c 2024-04-23 02:31:39.000000000 +0000
@@ -51,14 +51,29 @@
#endif /* TCP_CA_NAME_MAX */
#endif /* HAVE_TCP_CONGESTION */
+#ifdef __ANDROID__
+static void thread_signal_handler(int signum) {
+ pthread_exit(0);
+}
+#endif
+
void *
iperf_client_worker_run(void *s) {
struct iperf_stream *sp = (struct iperf_stream *) s;
struct iperf_test *test = sp->test;
/* Allow this thread to be cancelled even if it's in a syscall */
+#ifndef __ANDROID__
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
+#else
+ struct sigaction actions;
+ memset(&actions, 0, sizeof(actions));
+ sigemptyset(&actions.sa_mask);
+ actions.sa_flags = 0;
+ actions.sa_handler = thread_signal_handler;
+ sigaction(SIGUSR1, &actions, NULL);
+#endif
while (! (test->done) && ! (sp->done)) {
if (sp->sender) {
@@ -709,11 +724,11 @@ iperf_run_client(struct iperf_test * tes
if (sp->sender) {
int rc;
sp->done = 1;
- rc = pthread_cancel(sp->thr);
+ rc = pthread_kill(sp->thr, SIGUSR1);
if (rc != 0 && rc != ESRCH) {
i_errno = IEPTHREADCANCEL;
errno = rc;
- iperf_err(test, "sender cancel in pthread_cancel - %s", iperf_strerror(i_errno));
+ iperf_err(test, "sender cancel in pthread_kill - %s", iperf_strerror(i_errno));
goto cleanup_and_fail;
}
rc = pthread_join(sp->thr, NULL);
@@ -747,11 +762,11 @@ iperf_run_client(struct iperf_test * tes
if (!sp->sender) {
int rc;
sp->done = 1;
- rc = pthread_cancel(sp->thr);
+ rc = pthread_kill(sp->thr, SIGUSR1);
if (rc != 0 && rc != ESRCH) {
i_errno = IEPTHREADCANCEL;
errno = rc;
- iperf_err(test, "receiver cancel in pthread_cancel - %s", iperf_strerror(i_errno));
+ iperf_err(test, "receiver cancel in pthread_kill - %s", iperf_strerror(i_errno));
goto cleanup_and_fail;
}
rc = pthread_join(sp->thr, NULL);
@@ -788,11 +803,11 @@ iperf_run_client(struct iperf_test * tes
SLIST_FOREACH(sp, &test->streams, streams) {
sp->done = 1;
int rc;
- rc = pthread_cancel(sp->thr);
+ rc = pthread_kill(sp->thr, SIGUSR1);
if (rc != 0 && rc != ESRCH) {
i_errno = IEPTHREADCANCEL;
errno = rc;
- iperf_err(test, "cleanup_and_fail in pthread_cancel - %s", iperf_strerror(i_errno));
+ iperf_err(test, "cleanup_and_fail in pthread_kill - %s", iperf_strerror(i_errno));
}
rc = pthread_join(sp->thr, NULL);
if (rc != 0 && rc != ESRCH) {
--- a/src/iperf_server_api.c 2024-04-23 02:40:06.670277381 +0000
+++ b/src/iperf_server_api.c 2024-04-23 02:31:39.000000000 +0000
@@ -66,14 +66,29 @@
#endif /* TCP_CA_NAME_MAX */
#endif /* HAVE_TCP_CONGESTION */
+#ifdef __ANDROID__
+static void thread_signal_handler(int signum) {
+ pthread_exit(0);
+}
+#endif
+
void *
iperf_server_worker_run(void *s) {
struct iperf_stream *sp = (struct iperf_stream *) s;
struct iperf_test *test = sp->test;
/* Allow this thread to be cancelled even if it's in a syscall */
+#ifndef __ANDROID__
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
+#else
+ struct sigaction actions;
+ memset(&actions, 0, sizeof(actions));
+ sigemptyset(&actions.sa_mask);
+ actions.sa_flags = 0;
+ actions.sa_handler = thread_signal_handler;
+ sigaction(SIGUSR1, &actions, NULL);
+#endif
while (! (test->done) && ! (sp->done)) {
if (sp->sender) {
@@ -420,11 +435,11 @@ cleanup_server(struct iperf_test *test)
SLIST_FOREACH(sp, &test->streams, streams) {
int rc;
sp->done = 1;
- rc = pthread_cancel(sp->thr);
+ rc = pthread_kill(sp->thr, SIGUSR1);
if (rc != 0 && rc != ESRCH) {
i_errno = IEPTHREADCANCEL;
errno = rc;
- iperf_err(test, "cleanup_server in pthread_cancel - %s", iperf_strerror(i_errno));
+ iperf_err(test, "cleanup_server in pthread_kill - %s", iperf_strerror(i_errno));
}
rc = pthread_join(sp->thr, NULL);
if (rc != 0 && rc != ESRCH) {