Changeset 7 in Main for trunk/Server
- Timestamp:
- Sep 13, 2024, 7:40:53 PM (2 months ago)
- Location:
- trunk/Server
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Server/config.c
r6 r7 4 4 5 5 #include <stdio.h> 6 #include <stdint.h> 6 7 #include <stdlib.h> 7 8 #include <string.h> … … 12 13 struct tw_config config; 13 14 14 void tw_config_init(void) {} 15 void tw_config_init(void) { 16 int i; 17 for(i = 0; i < MAX_PORTS + 1; i++) { 18 config.ports[i] = -1; 19 } 20 } 15 21 16 22 int tw_config_read(const char* path) { … … 60 66 vhost = NULL; 61 67 } 68 } else if(cm_strcaseequ(r[0], "Listen") || cm_strcaseequ(r[0], "ListenSSL")) { 69 for(i = 1; r[i] != NULL; i++) { 70 uint64_t port = atoi(r[i]); 71 cm_log("Config", "Going to listen at port %d%s", (int)port, cm_strcaseequ(r[0], "ListenSSL") ? " with SSL" : ""); 72 if(cm_strcaseequ(r[0], "ListenSSL")) port |= (1ULL << 32); 73 int j; 74 for(j = 0; config.ports[j] != -1; j++) 75 ; 76 config.ports[j] = port; 77 } 62 78 } else { 63 79 if(r[0] != NULL) { -
trunk/Server/tw_config.h
r6 r7 4 4 #define __TW_CONFIG_H__ 5 5 6 #include <stdint.h> 7 8 /* I don't think you would listen to 1024 ports */ 9 #define MAX_PORTS 1024 10 6 11 struct tw_config_entry {}; 7 12 8 13 struct tw_config { 14 uint64_t ports[MAX_PORTS + 1]; /* If port & (1 << 32) is non-zero, it is SSL */ 9 15 struct tw_config_entry root; 10 16 };
Note:
See TracChangeset
for help on using the changeset viewer.