Commit Graph

664 Commits

Author SHA1 Message Date
Yury Selivanov 5bc48b3dfe win/tests: Use IOCP asyncio loop on Windows 2017-11-25 23:22:04 -05:00
Yury Selivanov 6d8636cbe8 win: Skip tests that are known not to work on windows 2017-11-25 23:22:04 -05:00
Yury Selivanov 80a5ee00ef win/tests: Fix a couple of loop.create_connection tests 2017-11-25 23:22:04 -05:00
Yury Selivanov be83f3db6d win: Fix testbase/tcp_server() to run when socket.AF_UNIX is n/a 2017-11-25 23:22:04 -05:00
Yury Selivanov 2e937cfdb8 win: Build libuv properly on Windows 2017-11-25 23:20:23 -05:00
Yury Selivanov fe0787f987 win: Don't try to use pthread_atfork on Windows 2017-11-25 23:18:51 -05:00
Yury Selivanov 5809486d02 win: Don't do first-try-write on Windows 2017-11-25 23:18:51 -05:00
Yury Selivanov c2defd0359 win: Use socket.dup() on Windows 2017-11-25 23:18:51 -05:00
Yury Selivanov 9a85c1431c win: Fix Poll handle to accept Windows sockets 2017-11-25 23:17:20 -05:00
Yury Selivanov edca068672 win: Split system.pxd into posix/windows includes 2017-11-25 23:17:20 -05:00
Yury Selivanov 3a6a329e21 win: Fix uv->sys error conversion code 2017-11-25 23:15:41 -05:00
Yury Selivanov 47267c15ed win: Fix setup.py to build on Windows 2017-11-25 23:15:41 -05:00
Yury Selivanov 82f6984580 win: Fix base tests to run 2017-11-25 23:11:55 -05:00
Yury Selivanov 14a8819779 Split test_process_lated_stdio_init test into 3 separate tests 2017-11-25 22:20:55 -05:00
Yury Selivanov 7778e718eb Better socket type check for Linux 2017-11-25 22:06:15 -05:00
Yury Selivanov d60be44dd1 Another clarification 2017-11-25 21:41:00 -05:00
Yury Selivanov 5c443974bf Clarify the use of manual socket io ref control in UDP transport 2017-11-25 21:29:53 -05:00
Yury Selivanov 2952077556 Fix typos 2017-11-25 18:46:46 -05:00
Yury Selivanov d5195d7c10 Simply detach() socket objects in UVHandle._close()
Some advantages:

* no close() syscall and no EBADF
* it's not possible to have any kind of FD race
2017-11-25 18:42:34 -05:00
Yury Selivanov 6bfe65dc60 Close attached file objects right in UVHandle._close() 2017-11-25 18:00:14 -05:00
Yury Selivanov 93ec1dbb1f tests: Split test_create_connection_1 into two tests 2017-11-25 14:49:42 -05:00
Yury Selivanov 95b75a15ae tests: Split test_create_unix_connection_1 into three tests 2017-11-25 14:35:55 -05:00
Yury Selivanov 796073dad5 Try fixing test_create_unix_connection_1 on slow MacOS Travis instances 2017-11-25 10:17:21 -05:00
Yury Selivanov f56fc75752 Fix travis tests 2017-11-25 10:11:41 -05:00
Yury Selivanov 827e802e8f Enable TCP_NODELAY for all TCP transports 2017-11-24 19:03:37 -05:00
Yury Selivanov eee6984ac1 Rewrite UDP transport from scratch.
The new implementation follows asyncio pretty closely.  We no longer use
uv_udp_* functions from libuv.  Instead, we use uv_poll_* and inherit
asyncio logic from selector_events.py.

When `loop.create_datagram_endpoint()` is called with a `remote_addr`
argument, asyncio attempts to *connect* the socket.  The old uvloop
implementation didn't do that, as there's no 'uv_udp_connect()' function
in libuv (at least yet).

For UDP it doesn't really matter if the socket is connected or not.  The
main difference is that when a UDP socket is connected, we can use
`socket.send(data)` method, instead of `socket.sendto(data, addr)`.

The subtle difference appears in two scenarios:

* using getsockname();

* raising an exception from `create_datagram_endpoint()` when
  `remote_addr` is unreachable.

It doesn't seem practical to wait until we have `uv_udp_connect()`
function in libuv, hence the rewrite.

In the future, when `uv_udp_connect()` is available, it should be easy
to rollback to the current implementation.

Addresses issues #109, #108, #85.
2017-11-24 18:35:18 -05:00
Yury Selivanov ce654bdc1a Add test_socket_sync_remove_and_immediately_close test 2017-11-24 17:04:04 -05:00
Yury Selivanov 1a8925c9fe Fix test_pseudosocket on Linux 2017-11-24 16:54:48 -05:00
Yury Selivanov 318e593e3f Implement pseudo-socket objects; don't dup() sockets
* `transport.get_extra_info('socket')` from now on will return a
  socket-like object.  That object will allow socket calls like
  `getsockopt()` and `setsockopt()` but will deny `close()`,
  `send()`, `recv()` and other invasive operations that might
  interfere with libuv.

* We no longer dup sockets when they are passed to APIs like
  `loop.create_server(sock=sock)`.  We now use `socket._io_refs`
  private API and new pseudo-sockets to guarantee that transports
  will work correctly even when users try to close the original
  socket object.
2017-11-24 16:46:19 -05:00
Yury Selivanov e19a233fde tests: Fix warnings 2017-11-24 16:02:36 -05:00
Yury Selivanov 3b210ea61c Fix connect_accepted_socket() to return correct SSL transport 2017-11-24 16:02:07 -05:00
Yury Selivanov da95cf03ab Fix sock_sendall() to correctly maintain add_writer/remove_writer calls 2017-11-24 16:01:26 -05:00
Yury Selivanov 6f3c788c78 pytest: Show all warnings 2017-11-24 15:58:12 -05:00
Yury Selivanov 9e8a53db18 Further optimize static DNS resolution 2017-11-23 16:15:18 -05:00
Yury Selivanov 6cc6a39aa2 Optimize __static_getaddrinfo a bit -- no need to raise an error 2017-11-23 15:50:46 -05:00
Yury Selivanov b7568a71c2 Fix tests under old Pythons 2017-11-22 15:31:15 -05:00
Yury Selivanov 6aa12780ed Fix test_aiohttp for debug build 2017-11-21 12:11:10 -05:00
Yury Selivanov 89343b58d5 Fix slow_callback_duration repr in warnings for Tasks.
Issue #103.
2017-11-21 11:30:36 -05:00
Yury Selivanov b45a4c0229 Fix slow_callback_duration repr in warnings for TimerHandles
Issue #103.
2017-11-21 11:19:52 -05:00
Yury Selivanov 135d060690 create_server() now makes a strong ref to the Server object.
Fixes #81.

Also makes Server objects weak-refable.
2017-11-21 11:02:15 -05:00
Yury Selivanov 45e89cf2ab travis: Use latest Python 3.6 on MacOS 2017-11-20 12:10:18 -05:00
Yury Selivanov 5c7c44c624 travis: Try Python 3.5.4 on MacOS 2017-11-18 15:30:09 -05:00
Yury Selivanov 86a6bdcd5b Remove existng stale UNIX socket paths in loop.create_unix_server() 2017-11-18 10:45:58 -05:00
Yury Selivanov c40e8a2297 Make a GC test more reliable. 2017-11-17 18:40:31 -05:00
Yury Selivanov ec50b7c4a2 Support Path objects in create_unix_connection() and create_unix_server() 2017-11-17 18:24:45 -05:00
Yury Selivanov 00d110a3f4 tests: Add test.unix_server() & test.unix_client() helpers. 2017-11-17 17:58:38 -05:00
Yury Selivanov f765546c94 Rewrite socket test framework 2017-11-17 17:42:31 -05:00
Yury Selivanov ab7ab938ed Implement .cancelled() method for callback and timer Handles. 2017-11-17 16:24:28 -05:00
Yury Selivanov cc80db62c1 Implement loop.sock_recv_into()
Mirrors asyncio PR: https://github.com/python/cpython/pull/4051
2017-11-17 09:44:10 -05:00
Yury Selivanov 4d0afc833b Limit stack traces in debug mode to make it faster.
Mirrors asyncio PR: https://github.com/python/cpython/pull/4322
2017-11-17 09:33:03 -05:00