Commit Graph

81 Commits

Author SHA1 Message Date
Bartosz Taudul
07bc665d8c
Drop support for Cygwin. 2021-10-07 23:28:40 +02:00
joshuakr
eac23cead2 PR feedback 2021-04-09 15:33:01 -07:00
Bartosz Taudul
025ab1626b Bind only on IPv4, if restricted to localhost.
This is needed, as disabling the IPV6_V6ONLY socket option doesn't work for
localhost listeners on Windows.
2020-12-16 15:33:05 +01:00
Bartosz Taudul
2049332211 Broadcast to localhost if listening only on localhost. 2020-12-16 15:27:00 +01:00
Bartosz Taudul
6f83044cf6 Broadcast to the given address. 2020-12-16 15:24:20 +01:00
Bartosz Taudul
b6724bec3a Ports are uint16_t. 2020-10-02 18:51:54 +02:00
Bartosz Taudul
0814812e9b Don't block when polling for broadcast messages. 2020-09-20 22:06:28 +02:00
Bartosz Taudul
e2d69e7981 Implement reading unknown lengths of data from socket. 2020-09-10 21:39:58 +02:00
Bartosz Taudul
72ce3ccf15 Allow issuing blocking connect calls on sockets. 2020-09-10 20:56:24 +02:00
Bartosz Taudul
813e45198d Cygwin uses BSD sockets API. 2020-09-06 14:11:29 +02:00
Graydon Hoare
2ea81a3ef9
Make TRACY_ONLY_IPV4 and TRACY_ONLY_LOCALHOST also settable with runtime env vars. 2020-08-27 11:21:24 -07:00
Graydon Hoare
30a6a5cdd1
Add support for TRACY_ONLY_IPV4 macro to exclude listening on IPv6 2020-08-27 11:21:24 -07:00
Bartosz Taudul
9455c92712 Handle broken inet_ntop on old Windows SDKs. 2020-08-11 22:37:46 +02:00
Bartosz Taudul
d8466c5839 Fix typo. 2020-06-20 18:50:05 +02:00
Bartosz Taudul
f7727f3aa4 Workaround broken connect implementation. 2020-06-20 18:35:21 +02:00
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