def test_EPIPE_on_connection(): a, b = socket.socketpair() c = Connections('test', 'dummy') c.add(a, 'remote') b.close() c.send('remote', 'message') # the bad file-descriptor is silently removed assert len(c.sockets) == 0
def test_EPIPE_on_connection_during_multisend(): a, b = socket.socketpair() c, d = socket.socketpair() c = Connections('test', 'dummy') c.add(a, 'remote') c.add(c, 'remote2') b.close() # exception should be swallowed on send c.send(c.ALL, 'message')
def test_EBADF_on_connection(): a, b = socket.socketpair() c = Connections('test', 'dummy') c.add(a, 'remote') a.close() # the bad file-descriptor is silently removed so we # will block here on this timeout with eventlet.Timeout(0.1): tools.assert_raises(eventlet.Timeout, c.get) assert len(c.sockets) == 0
def test_updated_sockets_during_select(): a, b = socket.socketpair() c = Connections('test', 'dummy') c.add(a, 'remote') def updater(c): a, b = socket.socketpair() c.add(a, 'new') d = Connections('test', 'remote_side') d.add(b, 'target') d.send('target', 'message') eventlet.spawn(updater, c) with eventlet.Timeout(1): c.get()
def test(): c1 = Connections('test', 'dummy1') c2 = Connections('test', 'dummy2') r, w = socket.socketpair() c1.add(r, 'dummy2') c2.add(w) c1.send('dummy2', 'test message') with eventlet.Timeout(1): sid, ret = c2.get() assert sid == 'dummy1' assert ret == 'test message' c2.send('dummy1', 'back atcha') with eventlet.Timeout(1): sid, ret = c1.get() assert sid == 'dummy2' assert ret == 'back atcha'
def updater(c): a, b = socket.socketpair() c.add(a, 'new') d = Connections('test', 'remote_side') d.add(b, 'target') d.send('target', 'message')