+ if (!FD_ISSET(ct->scc.fd, rfds))
+ return 0;
+ if (ct->status < CL_SENT_CH_RESPONSE)
+ trafo = trafo_context = NULL;
+ else {
+ trafo = sc_trafo;
+ trafo_context = ct->scc.recv;
+ }
+ if (!ct->sbc)
+ ct->sbc = sb_new_recv(0, trafo, trafo_context);
+again:
+ sb_get_recv_buffer(ct->sbc, &iov);
+ ret = read_nonblock(ct->scc.fd, iov.iov_base, iov.iov_len, rfds, &n);
+ if (ret < 0) {
+ sb_free(ct->sbc);
+ ct->sbc = NULL;
+ return ret;
+ }
+ if (n == 0)
+ return 0;
+ if (!sb_received(ct->sbc, n, result))
+ goto again;
+ ct->sbc = NULL;
+ return 1;
+}
+
+
+static char **parse_features(char *buf)
+{
+ int i;
+ const char id[] = "\nFeatures: ";
+ char *p, *q, **features;
+
+ p = strstr(buf, id);
+ if (!p)
+ return NULL;
+ p += strlen(id);
+ q = strchr(p, '\n');
+ if (!q)
+ return NULL;
+ *q = '\0';
+ create_argv(p, ",", &features);
+ for (i = 0; features[i]; i++)
+ PARA_INFO_LOG("server feature: %s\n", features[i]);
+ return features;
+}
+
+static bool has_feature(const char *feature, struct client_task *ct)
+{
+ return find_arg(feature, ct->features) >= 0? true : false;
+}
+
+/**
+ * The post select hook for client commands.
+ *
+ * \param s Pointer to the scheduler.
+ * \param t Pointer to the task struct for this command.
+ *
+ * Depending on the current state of the connection and the status of the read
+ * and write fd sets of \a s, this function performs the necessary steps to
+ * authenticate the connection, to send the command given by \a t->private_data
+ * and to receive para_server's output, if any.
+ *
+ * \sa struct sched, struct task.
+ */
+static void client_post_select(struct sched *s, struct task *t)
+{
+ struct client_task *ct = container_of(t, struct client_task, task);
+ struct btr_node *btrn = ct->btrn;
+ int ret = 0;
+ size_t n;
+ char buf[CLIENT_BUFSIZE];
+
+ t->error = 0;
+ if (ct->scc.fd < 0)