Skip to content

Commit d3e676c

Browse files
Sarah Larsenswlars
Sarah Larsen
authored andcommitted
Fix Issue #1632 fq-rate works in reverse
1 parent 0e90ae5 commit d3e676c

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

src/iperf_tcp.c

+16-15
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,22 @@ iperf_tcp_accept(struct iperf_test * test)
126126
i_errno = IESTREAMCONNECT;
127127
return -1;
128128
}
129+
#if defined(HAVE_SO_MAX_PACING_RATE)
130+
/* If fq socket pacing is specified, enable it. */
131+
132+
if (test->settings->fqrate) {
133+
/* Convert bits per second to bytes per second */
134+
unsigned int fqrate = test->settings->fqrate / 8;
135+
if (fqrate > 0) {
136+
if (test->debug) {
137+
printf("Setting fair-queue socket pacing to %u\n", fqrate);
138+
}
139+
if (setsockopt(s, SOL_SOCKET, SO_MAX_PACING_RATE, &fqrate, sizeof(fqrate)) < 0) {
140+
warning("Unable to set socket pacing");
141+
}
142+
}
143+
}
144+
#endif /* HAVE_SO_MAX_PACING_RATE */
129145

130146
if (Nread(s, cookie, COOKIE_SIZE, Ptcp) < 0) {
131147
i_errno = IERECVCOOKIE;
@@ -240,21 +256,6 @@ iperf_tcp_listen(struct iperf_test *test)
240256
return -1;
241257
}
242258
}
243-
#if defined(HAVE_SO_MAX_PACING_RATE)
244-
/* If fq socket pacing is specified, enable it. */
245-
if (test->settings->fqrate) {
246-
/* Convert bits per second to bytes per second */
247-
unsigned int fqrate = test->settings->fqrate / 8;
248-
if (fqrate > 0) {
249-
if (test->debug) {
250-
printf("Setting fair-queue socket pacing to %u\n", fqrate);
251-
}
252-
if (setsockopt(s, SOL_SOCKET, SO_MAX_PACING_RATE, &fqrate, sizeof(fqrate)) < 0) {
253-
warning("Unable to set socket pacing");
254-
}
255-
}
256-
}
257-
#endif /* HAVE_SO_MAX_PACING_RATE */
258259
{
259260
unsigned int rate = test->settings->rate / 8;
260261
if (rate > 0) {

0 commit comments

Comments
 (0)