+}
+
+#define AFS_CLIENT_TIMEOUT 3
+
+static void command_post_select(struct sched *s, struct task *t)
+{
+ struct command_task *ct = t->private_data;
+ struct sockaddr_un unix_addr;
+ struct afs_client *client, *tmp;
+
+ /* First, check the list of connected clients. */
+ list_for_each_entry_safe(client, tmp, &afs_client_list, node) {
+ if (FD_ISSET(client->fd, &s->rfds))
+ execute_afs_command(client->fd, ct->cookie);
+ else { /* prevent bogus connection flodding */
+ struct timeval diff;
+ tv_diff(now, &client->connect_time, &diff);
+ if (diff.tv_sec < AFS_CLIENT_TIMEOUT)
+ continue;
+ PARA_WARNING_LOG("connection timeout\n");
+ }
+ close(client->fd);
+ list_del(&client->node);
+ free(client);
+ }
+ /* Next, accept connections on the local socket. */
+ if (!FD_ISSET(ct->fd, &s->rfds))
+ goto out;
+ t->ret = para_accept(ct->fd, &unix_addr, sizeof(unix_addr));
+ if (t->ret < 0) {
+ PARA_NOTICE_LOG("%s\n", PARA_STRERROR(-t->ret));
+ goto out;
+ }
+ client = para_malloc(sizeof(*client));
+ client->fd = t->ret;
+ client->connect_time = *now;
+ para_list_add(&client->node, &afs_client_list);