Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32k
Description
Enhancement
This issue / PR addresses two missing servers from thesocketserver
module
Current behaviour
socketserver has the following
Protocol | Family | Simple | Forking | Threading |
---|---|---|---|---|
TCP | AF_INET | TCPServer | ForkingTCPServer | ThreadingTCPServer |
TCP | AF_UNIX | UnixStreamServer | ??? | ThreadingUnixStreamServer |
UDP | AF_INET | UDPServer | ForkingUDPServer | ThreadingUDPServer |
UDP | AF_UNIX | UnixDatagramServer | ??? | ThreadingUnixDatagramServer |
Observe the two gaps marked by "???"
Proposal
In the casehasattr(socket, "AF_UNIX") and hasattr(os, "fork")
we enable the two missing servers as
classForkingUnixStreamServer(ForkingMixIn,UnixStreamServer):passclassForkingUnixDatagramServer(ForkingMixIn,UnixDatagramServer):pass
These follow the established naming convention
This enhancement is completely forwards/backwards compatible
Mentions in the documentation are included in the PR corresponding to this issue
Pitch
GooglingForkingUnixStreamServer
shows a few people / codebases which define such a class in the same manner as above. I myself have done so in aproject.
These classes seem to have been overlooked because they require twoif
checks forhasattr(socket, "AF_UNIX")
andhasattr(os, "fork")
.
It seems clear to me therefore that these two classes should be added to thesocketserver
standard library module
Some people prefer forks to threads