aboutsummaryrefslogtreecommitdiff
path: root/server_network.c
diff options
context:
space:
mode:
authorTest_User <hax@andrewyu.org>2024-06-15 14:16:50 -0400
committerTest_User <hax@andrewyu.org>2024-06-15 14:16:50 -0400
commit88f9b2248bfb016514e340ee5eb81df7337fcc94 (patch)
treee206d68ce2dddd539f0694b85e04e2a49337b700 /server_network.c
parent8dca8643675830723d37f064d5417fb3e035385e (diff)
downloadhaxircd-88f9b2248bfb016514e340ee5eb81df7337fcc94.tar.gz
haxircd-88f9b2248bfb016514e340ee5eb81df7337fcc94.zip
Improvements and the start of reloadable modules
Diffstat (limited to 'server_network.c')
-rw-r--r--server_network.c33
1 files changed, 11 insertions, 22 deletions
diff --git a/server_network.c b/server_network.c
index 1afd370..bf9e442 100644
--- a/server_network.c
+++ b/server_network.c
@@ -95,15 +95,17 @@ int start_server_network_threads(size_t net) {
pthread_t trash; // Not actually used, so discard
struct server_network_info *type;
#ifdef USE_INSPIRCD2_PROTOCOL
- type = malloc(sizeof(*type));
- if (!type)
- return 1;
- type->net_type = net;
- type->protocol = INSPIRCD2_PROTOCOL;
- type->is_incoming = 1;
- if (pthread_create(&trash, &pthread_attr, server_accept_thread, type) != 0) {
- free(type);
- return 1;
+ if (SERVER_INCOMING[net][INSPIRCD2_PROTOCOL]) {
+ type = malloc(sizeof(*type));
+ if (!type)
+ return 1;
+ type->net_type = net;
+ type->protocol = INSPIRCD2_PROTOCOL;
+ type->is_incoming = 1;
+ if (pthread_create(&trash, &pthread_attr, server_accept_thread, type) != 0) {
+ free(type);
+ return 1;
+ }
}
#endif
return 0;
@@ -118,19 +120,6 @@ void * server_accept_thread(void *type) {
protocol = t->protocol;
}
- // Check if there is actually an incoming server connection configured using this net+protocol, and if not just return from this thread; some excess may have been spawned
- {
- char found = 0;
- for (size_t i = 0; i < SERVER_CONFIG_LEN; i++) {
- if (SERVER_CONFIG[i].protocol == protocol && !(SERVER_CONFIG[i].autoconnect)) { // TODO: Don't make autoconnect conflict with incoming connections
- found = 1;
- break;
- }
- }
- if (!found)
- return 0;
- }
-
int listen_fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (listen_fd < 0)
return 0;