u413-284-si / webserv

This project is about setting up a http web server, providing a static website.
MIT License
0 stars 0 forks source link

26 signal handling #57

Closed gwolf-011235 closed 1 month ago

gwolf-011235 commented 2 months ago

Summary (updated)

Summary was updated with new functionality: register specific signals; difference between quick and graceful shutdown. Additions marked with (NEW)

  1. New signal handler
  2. Incorporate signal handling in server
  3. New Connection state: Idle
  4. New ServerShutdown function
  5. Make Server::run() a non-member function
  6. Remove toString() in initVirtualServers()

1. Signal handling

2. Incorporate signal handling in server

3. Connection::Idle

4. serverShutdown function

5. Server::run > runServer(Server& server)

6. Remove toString

gwolf-011235 commented 2 months ago

Calls up memories of the struggles we had with the signal handling in minishell.

That reminds me: since we do use fork() for CGI, we would need to check which signal handler is registered, and if we need to change it. Also in case of sudden shutdown (aka interrupting the graceful shutdown - send signal two times) we would need to kill all spawned child processes. Something to keep in mind after CGI was added > should I open issue?

You tested it by trying out Ctrl+c and Ctrl+d?

Right now only SIGINT is registered, since it's easy to test (ctrl+c) Ctrl+d doesn't send a signal per se, it sends char EOF. Since we don't do input handling we don't care about it :D

u413-284-si commented 2 months ago

Yes, please create an issue for this.

gwolf-011235 commented 2 months ago

Yes, please create an issue for this.

Tracked as issue #60

gwolf-011235 commented 2 months ago

Regarding which signals should be handled:

@u413-284-si found these resources:

where

Since we're not expected to daemonize our server (see the informative man daemon(7) ), I would suggest to not implement reloading of config. Even we do want, I would track it as extra issue and not implement it in this PR.

However I will implement

gwolf-011235 commented 1 month ago

Updated with new functionality (in summary, additions marked with (NEW))