Skip to content

Commit

Permalink
Revert "Guard against OSError and SocketError when creating the contr…
Browse files Browse the repository at this point in the history
…ol socket"

This reverts commit 229ab9c.
  • Loading branch information
prologic committed Jan 18, 2017
1 parent 229ab9c commit 4b1619a
Showing 1 changed file with 9 additions and 18 deletions.
27 changes: 9 additions & 18 deletions circuits/core/pollers.py
Expand Up @@ -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):
Expand Down

0 comments on commit 4b1619a

Please sign in to comment.