vapor-community / sockets

🔌 Non-blocking TCP socket layer, with event-driven server and client.
MIT License
575 stars 54 forks source link

One thread per port? #84

Closed wildfiremedia closed 7 years ago

wildfiremedia commented 7 years ago

Is the current implementation use one thread per port/connection in sync rather than async or use DispatchSource/epoll to handle more workload?

tanner0101 commented 7 years ago

I don't quite understand the question here. Could you elaborate?

wildfiremedia commented 7 years ago

I see the file was naming SynchronousTCPServer.swift, is sock/tcp is running in synchronous instead of asynchronous request that do not block. Every synchronous call waits and blocks for your results to come back?

tanner0101 commented 7 years ago

I'm not 100% sure. This repo was donated to us.

That example server is just used to show off the socket capabilities. It isn't used in Vapor necessarily.

andreasley commented 7 years ago

I've recently created a few PRs to make Vapor nonblocking. Watch this issue for updates: https://github.com/vapor/engine/issues/66

andreasley commented 7 years ago

Implemented in https://github.com/vapor/socks/releases/tag/1.2.0 (with DispatchSource)