Commit Graph

66 Commits

Author SHA1 Message Date
Graydon Hoare
e76b8ae423
Add TRACY_ONLY_LOCALHOST macro to avoid listening on all interfaces. 2020-05-28 22:13:06 -07:00
Bartosz Taudul
d10ef8c501 Use non-blocking connect() call.
Exploit connect() error codes to determine whether connection was
established. Using poll/select proved to be problematic.
2020-05-14 02:27:04 +02:00
Bartosz Taudul
1fdae70cf8 Store socket handle in atomic. 2020-05-13 19:12:52 +02:00
Bartosz Taudul
1f3dc927c0 Close socket when listening fails. 2020-04-13 21:40:35 +02:00
Bartosz Taudul
5437976e65 Cosmetics. 2020-04-13 21:39:51 +02:00
Bartosz Taudul
1bbece649f Implement socket read without exit check. 2020-04-13 14:22:58 +02:00
Bartosz Taudul
e4ec666479 Don't use std::function in sockets. 2020-04-13 14:14:36 +02:00
Leander Beernaert
ac9f12a5f6 Review fixes
Update bracket style.

Remove erroneous else block.
2020-04-09 12:32:35 +02:00
Leander Beernaert
010376518f Fix incorrect handling of ipv4 case 2020-04-09 12:27:54 +02:00
Leander Beernaert
4201ebb28d ListenSocket: Fallback to ipv4
If we can't create a listener socket with the ipv6 protocol, try to
create one with the ipv4 protocol instead. This fixes the ListenSocket
on machines where ipv6 is not available or has been completely disabled.

This patch also exists ListenSocket::Listen() early if we fail to create
the socket.
2020-04-09 12:23:51 +02:00
Bartosz Taudul
65d146ddca Allow checking if socket is valid. 2019-12-19 17:23:40 +01:00
Bartosz Taudul
d4f4b73d56 Move socket buffer size from header to source file. 2019-12-08 23:14:48 +01:00
Bartosz Taudul
3e4913dc8a Reuse socket address also on BSD. 2019-11-21 20:41:57 +01:00
Bartosz Taudul
3282360382 Bind on both IPv6 and IPv4 on BSD. 2019-11-21 02:03:32 +01:00
Bartosz Taudul
a9cd5b331f BSD needs netinet/in.h for struct sockaddr_in and friends. 2019-11-21 01:28:48 +01:00
Bartosz Taudul
6bbf273581 Partial header inclusion cleanup. 2019-11-05 20:09:40 +01:00
Bartosz Taudul
106411e1f6 Add missing freeaddrinfo(). 2019-10-27 13:39:01 +01:00
Bartosz Taudul
707f113bda Add missing NOMINMAX definitions. 2019-10-10 20:29:06 +02:00
Bartosz Taudul
82cd667b30 Allow specifying network port in server. 2019-09-21 15:43:01 +02:00
Bartosz Taudul
e13cbf52fd Allow changing tracy port in client. 2019-09-21 15:11:15 +02:00
Rokas Kupstys
b391e4c21a Fix multiple build errors when compiling with MinGW. 2019-08-04 15:49:46 +03:00
Bartosz Taudul
a8cb257474 Revert "Resolve client host name using DNS."
This reverts commit 48df667a37.
2019-06-26 17:58:23 +02:00
Bartosz Taudul
fadf8e3e0a Can't read negative number of bytes.
This completely ignores error handling, which probably should be added.
The code behavior doesn't change, as the existing comparisons and
asserts already promoted the signed value to unsigned.
2019-06-22 14:08:48 +02:00
Bartosz Taudul
48df667a37 Resolve client host name using DNS.
This operation is blocking and should be made asynchronous.
2019-06-21 19:27:41 +02:00
Bartosz Taudul
12e44fc605 Missing include. 2019-06-17 19:51:58 +02:00
Bartosz Taudul
e0bbb41976 Add UDP listen socket and IP address wrapper. 2019-06-17 19:23:43 +02:00
Bartosz Taudul
de058d2a0d Don't hardcode broadcast port. 2019-06-17 18:37:34 +02:00
Bartosz Taudul
40e517594b Add UDP broadcast socket. 2019-06-17 02:24:55 +02:00
Bartosz Taudul
2bc7a9bd30 Close listen socket in destructor. 2019-06-09 18:14:26 +02:00
Bartosz Taudul
82dad3fb97 Use proper type. 2019-04-01 20:43:42 +02:00
Bartosz Taudul
d0d5184c04 Set options for proper socket. 2019-04-01 20:14:00 +02:00
Bartosz Taudul
687915299a Don't try to set socket options on invalid socket. 2019-04-01 20:08:27 +02:00
Bartosz Taudul
57cd6d3ed5 Allow retrieval of socket send buffer size. 2019-04-01 18:50:37 +02:00
Bartosz Taudul
c7e64bb8a8 Replace select() with poll(). 2019-02-10 15:45:23 +01:00
Bartosz Taudul
1585be7ff3 Rearrange Socket to reduce struct size. 2019-01-29 21:56:10 +01:00
Rokas Kupstys
8157e3a0b3 Fix builds with MingW. 2019-01-19 13:53:10 +02:00
Bartosz Taudul
f55f2858c4 Raw socket read function. 2018-09-09 18:24:58 +02:00
Bartosz Taudul
8b3895473d Gag inconsequential MSVC warnings in TracySocket.
Fix your API!
2018-08-22 16:29:15 +02:00
Bartosz Taudul
716166bc3a Expose InitWinSock(). 2018-08-19 18:15:46 +02:00
Till Rathmann
3b302315f9 Fixed __ANDROID_API__ < 21 build and FD_SET usage. 2018-08-01 19:18:40 +02:00
Till Rathmann
37d5736bf5 Fixed compiler warnings. 2018-08-01 14:07:30 +02:00
Bartosz Taudul
3799e0da43 Infer socket readiness from select() return value. 2018-07-16 01:50:21 +02:00
Bartosz Taudul
efdb3791e9 Take recv buffer into account in HasData(). 2018-07-15 19:52:22 +02:00
Bartosz Taudul
ea4470b26e Buffer data from recv() calls.
This reduces cost of socket reads measured in a test run from 47ms to
8.7ms.
2018-07-15 19:34:47 +02:00
Bartosz Taudul
eeeff40a70 Prevent TIME-WAIT connections from blocking listen address.
Of course Windows has to be retarded in its own special way and implement
SO_REUSEADDR with a completely different meaning.

http://www.andy-pearce.com/blog/posts/2013/Feb/so_reuseaddr-on-windows/
2018-04-27 19:18:09 +02:00
Bartosz Taudul
347c74cec3 Cosmetics. 2018-03-31 01:06:35 +02:00
Bartosz Szreder
9e3f18a62a Split data handling code from the view. 2018-02-21 16:41:37 +01:00
Bartosz Taudul
3dc7d04ab4 Properly handle connection reset on win32. 2017-11-04 17:19:28 +01:00
Bartosz Taudul
a2f9dc75c7 Set SO_NOSIGPIPE on proper socket. 2017-11-03 11:20:39 +01:00
Bartosz Taudul
c7cb89307f Use proper __APPLE__ macro. 2017-11-03 11:09:31 +01:00