aboutsummaryrefslogtreecommitdiff
path: root/server_network.c
diff options
context:
space:
mode:
authorTest_User <hax@andrewyu.org>2024-06-10 00:47:42 -0400
committerTest_User <hax@andrewyu.org>2024-06-10 00:47:42 -0400
commit525b2239812c815bf414d948e09c70f6b6ea2d31 (patch)
tree9cd24f0a982610f4db52bc45461cf2f93de8e5ab /server_network.c
parent3257fc554349975eb5e7e56756c86985dda751bc (diff)
downloadhaxircd-525b2239812c815bf414d948e09c70f6b6ea2d31.tar.gz
haxircd-525b2239812c815bf414d948e09c70f6b6ea2d31.zip
Incoming connection support for InspIRCd v2
Diffstat (limited to 'server_network.c')
-rw-r--r--server_network.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/server_network.c b/server_network.c
index aed6a41..5046bab 100644
--- a/server_network.c
+++ b/server_network.c
@@ -43,7 +43,15 @@
#include "gnutls_network.h"
#endif
+struct table server_config = {0};
+
int init_server_network(void) {
+ for (size_t i = 0; i < SERVER_CONFIG_LEN; i++) {
+ if (set_table_index(&server_config, SERVER_CONFIG[i].sid, &(SERVER_CONFIG[i])) != 0) {
+ return 1;
+ }
+ }
+
return 0;
}
@@ -62,9 +70,9 @@ int start_server_network(void) {
#endif
pthread_t trash;
- for (size_t i = 0; i < server_config_len; i++) {
- if (server_config[i].autoconnect) {
- if (pthread_create(&trash, &pthread_attr, protocols[server_config[i].protocol].autoconnect, &(server_config[i])) != 0) {
+ for (size_t i = 0; i < SERVER_CONFIG_LEN; i++) {
+ if (SERVER_CONFIG[i].autoconnect) {
+ if (pthread_create(&trash, &pthread_attr, protocols[SERVER_CONFIG[i].protocol].autoconnect, &(SERVER_CONFIG[i])) != 0) {
return 1;
}
}
@@ -103,8 +111,8 @@ void * server_accept_thread(void *type) {
// 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
+ 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;
}