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.
+
--zero::
-z::
Instead of sending random data, this option will set the client to send packets
return 0;
}
+static int handle_connection_ready(struct fireperf_config* conf,
+ struct fireperf_stats* stats, int fd, struct fireperf_random_pool* pool) {
+ // 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 send_data_to_server(conf, stats, fd, pool);
+}
+
int fireperf_client(struct fireperf_config* conf, struct fireperf_stats* stats,
int epollfd, int timerfd) {
struct fireperf_random_pool* pool = NULL;
stats->open_connections--;
} else if (events[i].events & EPOLLOUT) {
- r = send_data_to_server(conf, stats, fd, pool);
+ r = handle_connection_ready(conf, stats, fd, pool);
if (r)
goto ERROR;
}
static int parse_argv(int argc, char* argv[], struct fireperf_config* conf) {
static struct option long_options[] = {
{"client", required_argument, 0, 'c'},
+ {"close", no_argument, 0, 'x'},
{"debug", no_argument, 0, 'd'},
{"keepalive", no_argument, 0, 'k'},
{"parallel", required_argument, 0, 'P'},
int done = 0;
while (!done) {
- int c = getopt_long(argc, argv, "c:dkp:st:zP:V", long_options, &option_index);
+ int c = getopt_long(argc, argv, "c:dkp:st:xzP:V", long_options, &option_index);
// End
if (c == -1)
conf->timeout = strtoul(optarg, NULL, 10);
break;
+ case 'x':
+ conf->close = 1;
+ break;
+
case 'z':
conf->zero = 1;
break;
unsigned int listening_sockets;
unsigned long parallel;
unsigned int timeout;
+ int close;
int zero;
};