This commit is contained in:
2026-09-21 16:27:47 -07:00
parent e123c6344d
commit ad48802d54
2 changed files with 2 additions and 14 deletions
+1 -7
View File
@@ -25,11 +25,9 @@ typedef struct {
char *body;
} response;
// TODO: handlers need a way to respond to requests, maybe return a response with http code and body response
// we will provide them an already-allocated resp struct which they may fill
typedef void (*route_handler)(request *req, response *resp);
// addr should be in dot-separated notation
// addr should be in dot-separated notation (e.g. "0.0.0.0")
// returns NULL if error during creation
server *create_server(const char *addr, uint16_t port_number);
@@ -40,8 +38,4 @@ void destroy_server(server *s);
int start_server(server *s);
int register_route(server *s, const char *route, route_handler handler);
// TODO: implementation wise, we need the server to handle incoming connections, read the incoming bytes of the connection in another thread, and then route handlers from different threads...will this lead to various problems?
/* - what if a route handler uses some shared resource (e.g. service handler) to fulfill the request? and different calls of the handler from different threads calls that service handler? */
/* - keep it single-threaded for now. process one request at a time */
#endif // SERVER_H