示例#1
0
static void
on_ccnet_connected ()
{
    if (start_seaf_server () < 0)
        controller_exit(1);

    if (start_seaf_monitor () < 0)
        controller_exit(1);

    if (start_mq_client () < 0)
        controller_exit(1);

    add_client_fd_to_mainloop ();

    start_hearbeat_monitor ();
}
static void
on_ccnet_connected ()
{
    if (start_seaf_server () < 0)
        controller_exit(1);

    if (ctl->seafdav_config.enabled) {
        if (need_restart(PID_SEAFDAV)) {
            if (start_seafdav() < 0)
                controller_exit(1);
        }
    } else {
        seaf_message ("seafdav not enabled.\n");
    }

    add_client_fd_to_mainloop ();

    start_process_monitor ();
}
示例#3
0
int
connect_to_daemon (void)
{
    applet_message ("connecting ccnet ...\n");

    CcnetClient *client = applet->client;
    CcnetClient *sync_client = applet->sync_client;
    
    if (client->connected && sync_client->connected) {
        return 0;
    }

    if (!client->connected) {
        if (ccnet_client_connect_daemon (client, CCNET_CLIENT_ASYNC) < 0) {
            applet_warning("connect to ccnet daemon fail: %s\n", strerror(errno));
            trayicon_set_ccnet_state (CCNET_STATE_DOWN);
            return -1;
        }
    }

    if (!sync_client->connected) {
        if (ccnet_client_connect_daemon (sync_client, CCNET_CLIENT_SYNC) < 0) {
            applet_warning ("sync_client: connect to ccnet daemon failed: %s\n",
                            strerror(errno));
            applet_exit(1);
        }
    }

    trayicon_set_ccnet_state (CCNET_STATE_UP);
    
    add_client_fd_to_mainloop ();

    applet_init_ccnet_rpc (sync_client);
    applet_init_seafile_rpc (client);

    applet_start_rpc_service(client);
    start_mq_client ();

    return 0;
}