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

Deny new Connections but not drop existing #42

Closed
wasabii opened this issue Nov 9, 2018 · 2 comments
Closed

Deny new Connections but not drop existing #42

wasabii opened this issue Nov 9, 2018 · 2 comments
Assignees

Comments

@wasabii
Copy link

wasabii commented Nov 9, 2018

Is there a way to deny new connections to the server (stop the listener) without stopping existing connections? I would like to implement the ability to wait for connections to exit before Stop is processed.

@fubar-coder
Copy link
Contributor

You mean something like a pause/resume? No, it's not implemented, but a pull request is welcome 😊.

@fubar-coder
Copy link
Contributor

Will be fixed in 3.0.0-rc.4 or 3.0.0 (whatever comes first).

I'm not really happy with the API, but I cannot think of a better one:

// Get the FTP server
var ftpServer = serviceProvider.GetRequiredService<IFtpServer>();

// Cast to ICommunicationService and pause the server (accepting connections)
await ((ICommunicationService)ftpServer).PauseAsync(CancellationToken.None);

// Cast to ICommunicationService and continue the server (accepting connections)
await ((ICommunicationService)ftpServer).ContinueAsync(CancellationToken.None);

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

No branches or pull requests

2 participants