Skip to content
Permalink
Browse files

Revert "Guard against OSError and SocketError when creating the contr…

…ol socket"

This reverts commit 229ab9c.
  • Loading branch information...
prologic committed Jan 18, 2017
1 parent 229ab9c commit 4b1619a347a32e68b8a22db84d7a2c11d2d9460d
Showing with 9 additions and 18 deletions.
  1. +9 −18 circuits/core/pollers.py
@@ -57,29 +57,20 @@ def __init__(self, channel=channel):
def _create_control_con(self):
if platform.system() == "Linux":
return os.pipe()

server = create_socket(AF_INET, SOCK_STREAM)
server.bind(("localhost", 0))
server.listen(1)

server_sock = None
res_list = []

def accept():
global server_sock

try:
server_sock, _ = server.accept()
server_sock.setblocking(False)
except (OSError, SocketError):
server_sock = None

t = Thread(target=accept)
t.start()

client_sock = create_connection(server.getsockname())
t.join()

return server_sock, client_sock
sock, _ = server.accept()
sock.setblocking(False)
res_list.append(sock)
at = Thread(target=accept)
at.start()
clnt_sock = create_connection(server.getsockname())
at.join()
return (res_list[0], clnt_sock)

@handler("generate_events", priority=-9)
def _on_generate_events(self, event):

0 comments on commit 4b1619a

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.