Permalink
Browse files

need to schedule start emission

  • Loading branch information...
1 parent 70db547 commit ad87983478db09fde9436433dbb90286f39d9ce7 @mnot committed Feb 28, 2012
Showing with 4 additions and 3 deletions.
  1. +2 −1 thor/http/server.py
  2. +2 −2 thor/tcp.py
View
3 thor/http/server.py
@@ -37,6 +37,7 @@
import os
import sys
+from thor import schedule
from thor.events import EventEmitter, on
from thor.tcp import TcpServer
@@ -59,7 +60,7 @@ def __init__(self, host, port, loop=None):
EventEmitter.__init__(self)
self.tcp_server = self.tcp_server_class(host, port, loop=loop)
self.tcp_server.on('connect', self.handle_conn)
- self.emit('start')
+ schedule(0, self.emit, 'start')
def handle_conn(self, tcp_conn):
http_conn = HttpServerConnection(tcp_conn, self)
View
4 thor/tcp.py
@@ -38,7 +38,7 @@
import sys
import socket
-from thor.loop import EventSource
+from thor.loop import EventSource, schedule
class TcpConnection(EventSource):
@@ -251,7 +251,7 @@ def __init__(self, host, port, sock=None, loop=None):
self.sock = sock or server_listen(host, port)
self.on('readable', self.handle_accept)
self.register_fd(self.sock.fileno(), 'readable')
- self.emit('start')
+ schedule(0, self.emit, 'start')
def handle_accept(self):
try:

0 comments on commit ad87983

Please sign in to comment.