1
0
mirror of https://github.com/haiwen/seafile-server.git synced 2025-09-26 07:10:46 +00:00

Remove unused options from seaf-server.

This commit is contained in:
Jonathan Xu
2019-08-07 14:21:14 +08:00
parent 63a4395817
commit bb33ea7741
3 changed files with 32 additions and 57 deletions

View File

@@ -18,8 +18,6 @@
#include "seafile-session.h" #include "seafile-session.h"
#include "seafile-rpc.h" #include "seafile-rpc.h"
#include <ccnet/rpcserver-proc.h>
#include <ccnet/threaded-rpcserver-proc.h>
#include "log.h" #include "log.h"
#include "utils.h" #include "utils.h"
@@ -29,7 +27,7 @@ SeafileSession *seaf;
char *pidfile = NULL; char *pidfile = NULL;
static const char *short_options = "hvc:d:l:fg:G:P:mCD:F:"; static const char *short_options = "hvc:d:l:fP:D:F:";
static struct option long_options[] = { static struct option long_options[] = {
{ "help", no_argument, NULL, 'h', }, { "help", no_argument, NULL, 'h', },
{ "version", no_argument, NULL, 'v', }, { "version", no_argument, NULL, 'v', },
@@ -39,11 +37,7 @@ static struct option long_options[] = {
{ "log", required_argument, NULL, 'l' }, { "log", required_argument, NULL, 'l' },
{ "debug", required_argument, NULL, 'D' }, { "debug", required_argument, NULL, 'D' },
{ "foreground", no_argument, NULL, 'f' }, { "foreground", no_argument, NULL, 'f' },
{ "ccnet-debug-level", required_argument, NULL, 'g' },
{ "seafile-debug-level", required_argument, NULL, 'G' },
{ "master", no_argument, NULL, 'm'},
{ "pidfile", required_argument, NULL, 'P' }, { "pidfile", required_argument, NULL, 'P' },
{ "cloud-mode", no_argument, NULL, 'C'},
{ NULL, 0, NULL, 0, }, { NULL, 0, NULL, 0, },
}; };
@@ -59,7 +53,7 @@ static void usage ()
#define SEAFILE_RPC_PIPE_NAME "seafile.sock" #define SEAFILE_RPC_PIPE_NAME "seafile.sock"
static void start_rpc_service (int cloud_mode, char *seafile_dir) static void start_rpc_service (char *seafile_dir)
{ {
SearpcNamedPipeServer *rpc_server = NULL; SearpcNamedPipeServer *rpc_server = NULL;
char *pipe_path = NULL; char *pipe_path = NULL;
@@ -649,7 +643,6 @@ static void start_rpc_service (int cloud_mode, char *seafile_dir)
searpc_signature_string__string()); searpc_signature_string__string());
if (!cloud_mode) {
searpc_server_register_function ("seafserv-threaded-rpcserver", searpc_server_register_function ("seafserv-threaded-rpcserver",
seafile_set_inner_pub_repo, seafile_set_inner_pub_repo,
"set_inner_pub_repo", "set_inner_pub_repo",
@@ -674,7 +667,6 @@ static void start_rpc_service (int cloud_mode, char *seafile_dir)
seafile_list_inner_pub_repos_by_owner, seafile_list_inner_pub_repos_by_owner,
"list_inner_pub_repos_by_owner", "list_inner_pub_repos_by_owner",
searpc_signature_objlist__string()); searpc_signature_objlist__string());
}
/* History */ /* History */
searpc_server_register_function ("seafserv-threaded-rpcserver", searpc_server_register_function ("seafserv-threaded-rpcserver",
@@ -876,10 +868,6 @@ main (int argc, char **argv)
char *logfile = NULL; char *logfile = NULL;
const char *debug_str = NULL; const char *debug_str = NULL;
int daemon_mode = 1; int daemon_mode = 1;
int is_master = 0;
char *ccnet_debug_level_str = "info";
char *seafile_debug_level_str = "debug";
int cloud_mode = 0;
#ifdef WIN32 #ifdef WIN32
argv = get_argv_utf8 (&argc); argv = get_argv_utf8 (&argc);
@@ -913,21 +901,9 @@ main (int argc, char **argv)
case 'D': case 'D':
debug_str = optarg; debug_str = optarg;
break; break;
case 'g':
ccnet_debug_level_str = optarg;
break;
case 'G':
seafile_debug_level_str = optarg;
break;
case 'm':
is_master = 1;
break;
case 'P': case 'P':
pidfile = optarg; pidfile = optarg;
break; break;
case 'C':
cloud_mode = 1;
break;
default: default:
usage (); usage ();
exit (1); exit (1);
@@ -979,23 +955,20 @@ main (int argc, char **argv)
if (logfile == NULL) if (logfile == NULL)
logfile = g_build_filename (seafile_dir, "seafile.log", NULL); logfile = g_build_filename (seafile_dir, "seafile.log", NULL);
if (seafile_log_init (logfile, ccnet_debug_level_str, if (seafile_log_init (logfile, "info", "debug") < 0) {
seafile_debug_level_str) < 0) {
seaf_warning ("Failed to init log.\n"); seaf_warning ("Failed to init log.\n");
exit (1); exit (1);
} }
event_init (); event_init ();
start_rpc_service (cloud_mode, seafile_dir); start_rpc_service (seafile_dir);
seaf = seafile_session_new (central_config_dir, seafile_dir, ccnet_dir); seaf = seafile_session_new (central_config_dir, seafile_dir, ccnet_dir);
if (!seaf) { if (!seaf) {
seaf_warning ("Failed to create seafile session.\n"); seaf_warning ("Failed to create seafile session.\n");
exit (1); exit (1);
} }
seaf->is_master = is_master;
seaf->cloud_mode = cloud_mode;
#ifndef WIN32 #ifndef WIN32

View File

@@ -85,6 +85,10 @@ seafile_session_new(const char *central_config_dir,
session->tmp_file_dir = tmp_file_dir; session->tmp_file_dir = tmp_file_dir;
session->config = config; session->config = config;
session->cloud_mode = g_key_file_get_boolean (config,
"general", "cloud_mode",
NULL);
if (load_database_config (session) < 0) { if (load_database_config (session) < 0) {
seaf_warning ("Failed to load database config.\n"); seaf_warning ("Failed to load database config.\n");
goto onerror; goto onerror;

View File

@@ -62,8 +62,6 @@ struct _SeafileSession {
SizeScheduler *size_sched; SizeScheduler *size_sched;
int is_master;
int cloud_mode; int cloud_mode;
int rpc_thread_pool_size; int rpc_thread_pool_size;