+static FLIST_HEAD(client_list);
+
+static struct fio_client *find_client_by_fd(int fd)
+{
+ struct fio_client *client;
+ struct flist_head *entry;
+
+ flist_for_each(entry, &client_list) {
+ client = flist_entry(entry, struct fio_client, list);
+
+ if (client->fd == fd)
+ return client;
+ }
+
+ return NULL;
+}
+
+#if 0
+static struct fio_client *find_client_by_name(const char *name)
+{
+ struct fio_client *client;
+ struct flist_head *entry;
+
+ flist_for_each(entry, &client_list) {
+ client = flist_entry(entry, struct fio_client, list);
+
+ if (!strcmp(name, client->hostname))
+ return client;
+ }
+
+ return NULL;
+}
+#endif
+
+static void remove_client(struct fio_client *client)
+{
+ dprint(FD_NET, "removed client <%s>\n", client->hostname);
+ flist_del(&client->list);
+ nr_clients--;
+ free(client->hostname);
+ free(client);
+}
+
+void fio_client_add(const char *hostname)
+{
+ struct fio_client *client;
+
+ dprint(FD_NET, "added client <%s>\n", hostname);
+ client = malloc(sizeof(*client));
+ memset(client, 0, sizeof(*client));
+ client->hostname = strdup(hostname);
+ client->fd = -1;
+ flist_add(&client->list, &client_list);
+ nr_clients++;
+}
+
+static int fio_client_connect(struct fio_client *client)