static void remove_client(struct fio_client *client)
{
- printf("remove client %s\n", client->hostname);
+ dprint(FD_NET, "removed client <%s>\n", client->hostname);
flist_del(&client->list);
nr_clients--;
free(client->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);
{
int fd;
+ dprint(FD_NET, "connect to host %s\n", client->hostname);
+
memset(&client->addr, 0, sizeof(client->addr));
client->addr.sin_family = AF_INET;
client->addr.sin_port = htons(fio_net_port);
fd = socket(AF_INET, SOCK_STREAM, 0);
if (fd < 0) {
log_err("fio: socket: %s\n", strerror(errno));
- free(client);
return 1;
}
if (connect(fd, (struct sockaddr *) &client->addr, sizeof(client->addr)) < 0) {
log_err("fio: connect: %s\n", strerror(errno));
- free(client);
return 1;
}
off_t len;
int fd, ret;
+ dprint(FD_NET, "send ini %s to %s\n", filename, client->hostname);
+
fd = open(filename, O_RDONLY);
if (fd < 0) {
log_err("fio: job file open: %s\n", strerror(errno));
struct fio_net_cmd *cmd;
while ((cmd = fio_net_cmd_read(client->fd)) != NULL) {
+ dprint(FD_NET, "%s: got cmd op %d\n", client->hostname,
+ cmd->opcode);
+
if (cmd->opcode == FIO_NET_CMD_ACK) {
free(cmd);
continue;
struct fio_client *client;
struct flist_head *entry;
struct pollfd *pfds;
- int i = 0, ret = 0;
+ int i, ret = 0;
pfds = malloc(nr_clients * sizeof(struct pollfd));
- flist_for_each(entry, &client_list) {
- client = flist_entry(entry, struct fio_client, list);
+ while (!exit_backend && nr_clients) {
+ i = 0;
+ flist_for_each(entry, &client_list) {
+ client = flist_entry(entry, struct fio_client, list);
- pfds[i].fd = client->fd;
- pfds[i].events = POLLIN;
- i++;
- }
+ pfds[i].fd = client->fd;
+ pfds[i].events = POLLIN;
+ i++;
+ }
+
+ assert(i == nr_clients);
- while (!exit_backend && nr_clients) {
ret = poll(pfds, nr_clients, 100);
if (ret < 0) {
if (errno == EINTR)
}
free(pfds);
-
return 0;
}