Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle signals and gracefully shut down, waiting for clients #22

Merged
merged 1 commit into from
Apr 1, 2021

Conversation

JonathonReinhart
Copy link
Collaborator

@JonathonReinhart JonathonReinhart commented Mar 18, 2021

Handle SIGINT, SIGQUIT, and SIGTERM by gracefully shutting down the SMTP server and waiting for all child connections to finish.

This PR is a result of discussions on #13 and is based loosely on grafana#11.

One can easily verify the behavior by:

  • Run smtprelay
  • Telnet to the server
  • Press Ctrl+C in smtprelay and observe that it is still running
  • Close the telnet connection and observe smtprelay stop

@JonathonReinhart
Copy link
Collaborator Author

Now that chrj/smtpd#11 is merged and v0.3.0 has been released, I've squashed and rebased this onto master.

main.go Outdated Show resolved Hide resolved
@decke
Copy link
Owner

decke commented Mar 31, 2021

Great work! This looks like a really nice way to handle this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants