Skip to content

Commit

Permalink
Allow current host in peers (#25)
Browse files Browse the repository at this point in the history
There are legitimate cases where one might want to use the current host
in "peers". In particular our tests do this by using "localhost"; this
*usually* works because the hostname returned by `gethostname` is the
~unique name of the host, so doesn't match "localhost".

In some environments, though, `gethostname` can return "localhost",
which causes the peer to get filtered out. Notably this includes nix
build environments, which intentionally avoid letting global unique
state into the environment, since it would make the build
non-reproducible.
  • Loading branch information
sporksmith authored Dec 13, 2021
1 parent 0967bde commit 8cec86f
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions src/tgen-optionparser.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,6 @@ GError* tgenoptionparser_parsePeer(const gchar* attributeName,
return error;
}

/* dont add my own address to the server pool */
char myname[128];
if (!tgenconfig_gethostname(&myname[0], 128)
&& !g_ascii_strcasecmp(myname, tokens[0])) {
tgen_info("refusing to place my address in server pool for attribute '%s'", attributeName);
return NULL;
}

gchar* name = tokens[0];
in_port_t port = 0;
guint64 portNum = g_ascii_strtoull(tokens[1], NULL, 10);
Expand Down

0 comments on commit 8cec86f

Please sign in to comment.