-V::
Prints the version of this program
+--close::
+-x::
+ If set, all connections will be closed as soon as they have been established.
+ No data will be sent.
+ +
+ This is useful to test how many TCP handshakes per second are possible.
+
--zero::
-z::
Instead of sending random data, this option will set the client to send packets
If set, the client will automatically terminate itself after T seconds.
Otherwise it will run for forever.
---close::
--x::
- If set, all connections will be closed as soon as they have been established.
- No data will be sent.
- +
- This is useful to test how many TCP handshakes per second are possible.
-
== BUGS
Please report all bugs to the bugtracker at https://bugzilla.ipfire.org/
return -1;
}
-static int handle_connection_ready(struct fireperf_config* conf,
- struct fireperf_stats* stats, int fd) {
- // Are we supposed to close this connection straight away?
- if (conf->close) {
- DEBUG(conf, "Closing connection %d\n", fd);
- close(fd);
-
- stats->open_connections--;
-
- return 0;
- }
-
- return handle_connection_send(conf, stats, fd);
-}
-
int fireperf_client(struct fireperf_config* conf, struct fireperf_stats* stats,
int epollfd, int timerfd) {
DEBUG(conf, "Launching " PACKAGE_NAME " in client mode\n");
stats->open_connections--;
} else {
+ // Close connections immediately when -x is set
+ if (conf->close) {
+ DEBUG(conf, "Closing connection %d\n", fd);
+ close(fd);
+
+ stats->open_connections--;
+ continue;
+ }
+
// Handle incoming data
if (events[i].events & EPOLLIN) {
r = handle_connection_recv(conf, stats, fd);
// Handle outgoing data
if (events[i].events & EPOLLOUT) {
- r = handle_connection_ready(conf, stats, fd);
+ r = handle_connection_send(conf, stats, fd);
if (r)
goto ERROR;
}
continue;
}
+ // Close connections immediately when -x is set
+ if (conf->close) {
+ DEBUG(conf, "Closing connection %d\n", fd);
+ close(fd);
+
+ stats->open_connections--;
+ continue;
+ }
+
// Handle incoming data
if (events[i].events & EPOLLIN) {
r = handle_connection_recv(conf, stats, fd);