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

Avoid an error log when the stop is requested #498

Open
WinXaito opened this issue Nov 27, 2024 · 0 comments
Open

Avoid an error log when the stop is requested #498

WinXaito opened this issue Nov 27, 2024 · 0 comments

Comments

@WinXaito
Copy link

Hi, I do that to serve my FTP server:

go func(srv *ftpserver.FtpServer) {
	<-ctx.Done()
	if err := srv.Stop(); err != nil {
		log.Error().Err(err).Msg("ftpserver: stop error")
	}
}(m.srv)

return m.srv.ListenAndServe()

Note that srv is created like that, with the adapter because I use zerolog:

srv := ftpserver.NewFtpServer(drv)
srv.Logger = adapter.NewWrap(&log.Logger)

Now, when I stop my app, I got this in the log:

27/11/2024 12:25:34.938 ERR Serve error err={"Addr":{"IP":"::","Port":2121,"Zone":""},"Err":{},"Net":"tcp","Op":"accept","Source":null}

I think it's caused by this line. Maybe this method should test if a Stop has been requested and do not throw that error.

I use version 0.24.1.

@WinXaito WinXaito changed the title Avoid an error log when the stop is expected Avoid an error log when the stop is requested Nov 27, 2024
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

No branches or pull requests

1 participant