mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-29 08:54:34 +00:00
Make TRACY_ONLY_IPV4 and TRACY_ONLY_LOCALHOST also settable with runtime env vars.
This commit is contained in:
parent
30a6a5cdd1
commit
2ea81a3ef9
@ -393,7 +393,11 @@ static int addrinfo_and_socket_for_family(int port, int ai_family, struct addrin
|
||||
hints.ai_family = ai_family;
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
#ifndef TRACY_ONLY_LOCALHOST
|
||||
hints.ai_flags = AI_PASSIVE;
|
||||
const char* onlyLocalhost = getenv( "TRACY_ONLY_LOCALHOST" );
|
||||
if( !onlyLocalhost || onlyLocalhost[0] != '1' )
|
||||
{
|
||||
hints.ai_flags = AI_PASSIVE;
|
||||
}
|
||||
#endif
|
||||
char portbuf[32];
|
||||
sprintf( portbuf, "%i", port );
|
||||
@ -410,7 +414,11 @@ bool ListenSocket::Listen( int port, int backlog )
|
||||
struct addrinfo* res = nullptr;
|
||||
|
||||
#ifndef TRACY_ONLY_IPV4
|
||||
m_sock = addrinfo_and_socket_for_family(port, AF_INET6, &res);
|
||||
const char* onlyIPv4 = getenv( "TRACY_ONLY_IPV4" );
|
||||
if( !onlyIPv4 || onlyIPv4[0] != '1' )
|
||||
{
|
||||
m_sock = addrinfo_and_socket_for_family(port, AF_INET6, &res);
|
||||
}
|
||||
#endif
|
||||
if (m_sock == -1)
|
||||
{
|
||||
|
@ -425,9 +425,9 @@ By default Tracy client will announce its presence to the local network\footnote
|
||||
|
||||
\subsubsection{Client network interface}
|
||||
|
||||
By default Tracy client will listen on all network interfaces. If you want to restrict it to only listening on the localhost interface, define the \texttt{TRACY\_ONLY\_LOCALHOST} macro.
|
||||
By default Tracy client will listen on all network interfaces. If you want to restrict it to only listening on the localhost interface, define the \texttt{TRACY\_ONLY\_LOCALHOST} macro at compile time, or set the \texttt{TRACY\_ONLY\_LOCALHOST} environment variable to $1$ at runtime.
|
||||
|
||||
By default Tracy client will listen on IPv6 interfaces, falling back to IPv4 only if IPv6 is not available. If you want to restrict it to only listening on IPv4 interfaces, define the \texttt{TRACY\_ONLY\_IPV4} macro.
|
||||
By default Tracy client will listen on IPv6 interfaces, falling back to IPv4 only if IPv6 is not available. If you want to restrict it to only listening on IPv4 interfaces, define the \texttt{TRACY\_ONLY\_IPV4} macro at compile time, or set the \texttt{TRACY\_ONLY\_IPV4} environment variable to $1$ at runtime.
|
||||
|
||||
\subsubsection{Setup for multi-DLL projects}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user