Skip to content

Commit

Permalink
Fix chrysn#269: allow overriding server transports
Browse files Browse the repository at this point in the history
  • Loading branch information
roysjosh committed Jan 21, 2022
1 parent 1f03d4c commit 06f6386
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions aiocoap/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ async def create_client_context(cls, *, loggername="coap", loop=None):

@classmethod
@AwaitOrAenter.decorate
async def create_server_context(cls, site, bind=None, *, loggername="coap-server", loop=None, _ssl_context=None, multicast=[], server_credentials=None):
async def create_server_context(cls, site, bind=None, *, loggername="coap-server", loop=None, _ssl_context=None, multicast=[], server_credentials=None, transports=[]):
"""Create a context, bound to all addresses on the CoAP port (unless
otherwise specified in the ``bind`` argument).
Expand Down Expand Up @@ -250,7 +250,9 @@ async def create_server_context(cls, site, bind=None, *, loggername="coap-server

multicast_done = not multicast

for transportname in defaults.get_default_servertransports(loop=loop):
selected_transports = len(transports) > 0 and transports or defaults.get_default_servertransports(loop=loop)

for transportname in selected_transports:
if transportname == 'udp6':
from .transports.udp6 import MessageInterfaceUDP6

Expand Down

0 comments on commit 06f6386

Please sign in to comment.