Last active
December 22, 2015 23:39
-
-
Save jonashaag/6548722 to your computer and use it in GitHub Desktop.
Basic sketch of a bjoern backend for Chausette
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bjoern | |
class Server(object): | |
def __init__(self, listener, application=None, backlog=None, | |
socket_type=None, address_family=None): | |
assert backlog is None, "bjoern backend does not support the 'backlog' option" | |
assert socket_type is None, "bjoern backend does not support the 'socket_type' option" | |
assert address_familiy in (AF_INET, AF_UNIX) | |
host, port = listener | |
if host.startswith('fd://'): | |
raise ValueError("bjoern backend does not support 'fd://' sockets") | |
else: | |
bjoern.listen(host, port, application) | |
def serve_forever(self): | |
bjoern.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Very nice