Navigation Menu

Skip to content

Commit

Permalink
Merge pull request #172 from naoa/fix-for-gqtp-protocol
Browse files Browse the repository at this point in the history
Fix the protocol of the gqtp package and change default port number in client mode.

Patch by Naoya Murakami. Thanks!!!
  • Loading branch information
kou committed Jun 5, 2014
2 parents 8a1f53e + a1cde3e commit 94d3cf4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion data/init.d/redhat/groonga-server-gqtp
Expand Up @@ -30,7 +30,7 @@ DATABASE=/var/lib/groonga/db/db
ADDRESS=127.0.0.1
PORT=10043
PIDFILE=/var/run/groonga/$prog-gqtp.pid
PROTOCOL=http
PROTOCOL=gqtp
LOG_PATH=/var/log/groonga/groonga-gqtp.log
QUERY_LOG_PATH=/var/log/groonga/query-gqtp.log
OPTION_ARGS=""
Expand Down
21 changes: 14 additions & 7 deletions src/groonga.c
Expand Up @@ -69,7 +69,8 @@
# define STDERR_FILENO 2
#endif /* STDERR_FILENO */

#define DEFAULT_PORT 10041
#define DEFAULT_HTTP_PORT 10041
#define DEFAULT_GQTP_PORT 10043
#define DEFAULT_DEST "localhost"
#define DEFAULT_MAX_NFTHREADS 8
#define MAX_CON 0x10000
Expand All @@ -78,7 +79,7 @@

static char bind_address[HOST_NAME_MAX + 1];
static char hostname[HOST_NAME_MAX + 1];
static int port = DEFAULT_PORT;
static int port = DEFAULT_GQTP_PORT;
static int batchmode;
static int number_of_lines = 0;
static int newdb;
Expand Down Expand Up @@ -2097,7 +2098,8 @@ config_file_load(const char *path, const grn_str_getopt_opt *opts, int *flags)
return status;
}

static const int default_port = DEFAULT_PORT;
static const int default_http_port = DEFAULT_HTTP_PORT;
static const int default_gqtp_port = DEFAULT_GQTP_PORT;
static grn_encoding default_encoding = GRN_ENC_DEFAULT;
static uint32_t default_max_num_threads = DEFAULT_MAX_NFTHREADS;
static const int default_mode = mode_alone;
Expand Down Expand Up @@ -2306,7 +2308,8 @@ show_usage(FILE *output)
" --bind-address <ip/hostname>:\n"
" specify server address to bind\n"
" (default: %s)\n"
" -p, --port <port number>: specify server port number (default: %d)\n"
" -p, --port <port number>: specify server port number\n"
" (HTTP default: %d, GQTP default: %d)\n"
" -i, --server-id <ip/hostname>:\n"
" specify server ID address (default: %s)\n"
" --protocol <protocol>: specify server protocol to listen\n"
Expand Down Expand Up @@ -2350,8 +2353,8 @@ show_usage(FILE *output)
" <db pathname>: in server/daemon mode\n"
" <dest hostname> [<commands>]: in client mode (default: %s)\n",
grn_encoding_to_string(default_encoding),
default_port, default_bind_address,
default_port, default_hostname, default_protocol,
default_gqtp_port, default_bind_address,
default_http_port, default_gqtp_port, default_hostname, default_protocol,
default_document_root, default_cache_limit, default_max_num_threads,
default_log_level, default_log_path, default_query_log_path,
default_config_path, default_default_command_version,
Expand Down Expand Up @@ -2498,7 +2501,11 @@ main(int argc, char **argv)
}
port = value;
} else {
port = default_port;
if (protocol_arg) {
if (*protocol_arg == 'h' || *protocol_arg == 'H') {
port = default_http_port;
}
}
}

if (encoding_arg) {
Expand Down

0 comments on commit 94d3cf4

Please sign in to comment.