|
@@ -95,6 +95,7 @@ struct ggd_export { |
|
|
SLIST_ENTRY(ggd_export) e_next; |
|
|
SLIST_ENTRY(ggd_export) e_next; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
static int niothreads = 20; |
|
|
static const char *exports_file = GGATED_EXPORT_FILE; |
|
|
static const char *exports_file = GGATED_EXPORT_FILE; |
|
|
static int got_sighup = 0; |
|
|
static int got_sighup = 0; |
|
|
|
|
|
|
|
@@ -530,6 +531,7 @@ connection_launch(struct ggd_connection *conn) |
|
|
{ |
|
|
{ |
|
|
pthread_t td; |
|
|
pthread_t td; |
|
|
int error, pid; |
|
|
int error, pid; |
|
|
|
|
|
int i; |
|
|
|
|
|
|
|
|
pid = fork(); |
|
|
pid = fork(); |
|
|
if (pid > 0) |
|
|
if (pid > 0) |
|
@@ -581,6 +583,14 @@ connection_launch(struct ggd_connection *conn) |
|
|
g_gate_xlog("pthread_create(recv_thread): %s.", |
|
|
g_gate_xlog("pthread_create(recv_thread): %s.", |
|
|
strerror(error)); |
|
|
strerror(error)); |
|
|
} |
|
|
} |
|
|
|
|
|
for (i = 0; niothreads && i < niothreads - 1; i++) { |
|
|
|
|
|
error = pthread_create(&td, NULL, disk_thread, conn); |
|
|
|
|
|
if (error != 0) { |
|
|
|
|
|
g_gate_xlog("pthread_create(disk_thread): %s.", |
|
|
|
|
|
strerror(error)); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
disk_thread(conn); |
|
|
disk_thread(conn); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@@ -1017,7 +1027,7 @@ main(int argc, char *argv[]) |
|
|
|
|
|
|
|
|
bindaddr = htonl(INADDR_ANY); |
|
|
bindaddr = htonl(INADDR_ANY); |
|
|
port = G_GATE_PORT; |
|
|
port = G_GATE_PORT; |
|
|
while ((ch = getopt(argc, argv, "a:hnp:F:R:S:s:v")) != -1) { |
|
|
|
|
|
|
|
|
while ((ch = getopt(argc, argv, "a:hnp:q:F:R:S:s:v")) != -1) { |
|
|
switch (ch) { |
|
|
switch (ch) { |
|
|
case 'a': |
|
|
case 'a': |
|
|
bindaddr = g_gate_str2ip(optarg); |
|
|
bindaddr = g_gate_str2ip(optarg); |
|
@@ -1038,6 +1048,11 @@ main(int argc, char *argv[]) |
|
|
if (port == 0 && errno != 0) |
|
|
if (port == 0 && errno != 0) |
|
|
errx(EXIT_FAILURE, "Invalid port."); |
|
|
errx(EXIT_FAILURE, "Invalid port."); |
|
|
break; |
|
|
break; |
|
|
|
|
|
case 'q': |
|
|
|
|
|
niothreads = strtol(optarg, NULL, 10); |
|
|
|
|
|
if (niothreads < 0) |
|
|
|
|
|
errx(EXIT_FAILURE, "Invalid queue size."); |
|
|
|
|
|
break; |
|
|
case 'R': |
|
|
case 'R': |
|
|
errno = 0; |
|
|
errno = 0; |
|
|
rcvbuf = strtoul(optarg, NULL, 10); |
|
|
rcvbuf = strtoul(optarg, NULL, 10); |
|
|