source:
ralphm-patches/router_unknown.patch
@
54:03ec57713c90
Last change on this file since 54:03ec57713c90 was 54:03ec57713c90, checked in by Ralph Meijer <ralphm@…>, 11 years ago | |
---|---|
File size: 1.6 KB |
-
wokkel/component.py
# HG changeset patch # Parent 28a032eab8a5ffbc145aaec1f0044a2a9cad7058 Send back an error if there is no known route to the stanza's destination. This is most useful in situations where there is no server-to-server component that acts as the default route (indexed by `None`). diff -r 28a032eab8a5 wokkel/component.py
a b 313 313 """ 314 314 destination = JID(stanza['to']) 315 315 316 log.msg("Routing to %s: %r" % (destination.full(), stanza.toXml()))317 316 318 317 if destination.host in self.routes: 318 msg = "Routing to %s (default route): %r" 319 log.msg("Routing to %s: %r" % (destination.full(), 320 stanza.toXml())) 319 321 self.routes[destination.host].send(stanza) 322 elif None in self.routes: 323 log.msg("Routing to %s (default route): %r" % (destination.full(), 324 stanza.toXml())) 325 self.routes[None].send(stanza) 320 326 else: 321 self.routes[None].send(stanza) 327 log.msg("No route to %s: %r" % (destination.full(), 328 stanza.toXml())) 329 if stanza.getAttribute('type') not in ('result', 'error'): 330 # No route, send back error 331 exc = error.StanzaError('remote-server-timeout', type='wait') 332 exc.code = '504' 333 response = exc.toResponse(stanza) 334 self.route(response) 322 335 323 336 324 337
Note: See TracBrowser
for help on using the repository browser.