OLD | NEW |
1 #!/usr/bin/python2.4 | 1 #!/usr/bin/python2.4 |
2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """A bare-bones and non-compliant XMPP server. | 6 """A bare-bones and non-compliant XMPP server. |
7 | 7 |
8 Just enough of the protocol is implemented to get it to work with | 8 Just enough of the protocol is implemented to get it to work with |
9 Chrome's sync notification system. | 9 Chrome's sync notification system. |
10 """ | 10 """ |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 | 513 |
514 def __init__(self, socket_map, addr): | 514 def __init__(self, socket_map, addr): |
515 asyncore.dispatcher.__init__(self, None, socket_map) | 515 asyncore.dispatcher.__init__(self, None, socket_map) |
516 self.create_socket(socket.AF_INET, socket.SOCK_STREAM) | 516 self.create_socket(socket.AF_INET, socket.SOCK_STREAM) |
517 self.set_reuse_addr() | 517 self.set_reuse_addr() |
518 self.bind(addr) | 518 self.bind(addr) |
519 self.listen(5) | 519 self.listen(5) |
520 self._socket_map = socket_map | 520 self._socket_map = socket_map |
521 self._socket_map[self.fileno()] = self | 521 self._socket_map[self.fileno()] = self |
522 self._connections = set() | 522 self._connections = set() |
523 print 'XMPP server running at %s' % AddrString(addr) | |
524 | 523 |
525 def handle_accept(self): | 524 def handle_accept(self): |
526 (sock, addr) = self.accept() | 525 (sock, addr) = self.accept() |
527 XmppConnection(sock, self._socket_map, self._connections, addr) | 526 XmppConnection(sock, self._socket_map, self._connections, addr) |
OLD | NEW |