Skip to content

Instantly share code, notes, and snippets.

@jonashaag
Last active December 22, 2015 23:39
Show Gist options
  • Save jonashaag/6548722 to your computer and use it in GitHub Desktop.
Save jonashaag/6548722 to your computer and use it in GitHub Desktop.
Basic sketch of a bjoern backend for Chausette
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()
@Natim
Copy link

Natim commented Sep 13, 2013

Nice :)

@pcdinh
Copy link

pcdinh commented Sep 13, 2013

Very nice

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