sched: Allow more than one running scheduler instance.
[paraslash.git] / client_common.c
index eb9f9e1fcda2a49ba960582ba67be9c882897a20..85978c8ea24db5e5c0f90610e8feb77851eb6739 100644 (file)
@@ -310,7 +310,7 @@ out:
 }
 
 /* connect to para_server and register the client task */
-static int client_connect(struct client_task *ct)
+static int client_connect(struct sched *s, struct client_task *ct)
 {
        int ret;
 
@@ -327,7 +327,7 @@ static int client_connect(struct client_task *ct)
        ct->task.pre_select = client_pre_select;
        ct->task.post_select = client_post_select;
        sprintf(ct->task.status, "client");
-       register_task(&ct->task);
+       register_task(s, &ct->task);
        return 1;
 err_out:
        close(ct->scc.fd);
@@ -345,6 +345,7 @@ err_out:
  * \param loglevel If not \p NULL, the number of the loglevel is stored here.
  * \param parent Add the new buffer tree node as a child of this node.
  * \param child Add the new buffer tree node as a parent of this node.
+ * \param sched The scheduler instance to register the task to.
  *
  * Check the command line options given by \a argc and argv, set default values
  * for user name and rsa key file, read further option from the config file.
@@ -353,7 +354,8 @@ err_out:
  * \return Standard.
  */
 int client_open(int argc, char *argv[], struct client_task **ct_ptr,
-               int *loglevel, struct btr_node *parent, struct btr_node *child)
+               int *loglevel, struct btr_node *parent, struct btr_node *child,
+               struct sched *sched)
 {
        char *home = para_homedir();
        int ret;
@@ -413,7 +415,7 @@ int client_open(int argc, char *argv[], struct client_task **ct_ptr,
        PARA_INFO_LOG("key_file: %s\n", ct->key_file);
        PARA_NOTICE_LOG("connecting %s:%d\n", ct->conf.hostname_arg,
                ct->conf.server_port_arg);
-       ret = client_connect(ct);
+       ret = client_connect(sched, ct);
 out:
        free(home);
        if (ret < 0) {