Skip to content

Commit d8370f7

Browse files
authored
Merge pull request #757 from mpromonet/master
zpinger: add gossip option to allow to connect using tcp
2 parents 4931d61 + 43f648a commit d8370f7

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

src/zpinger.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ int main (int argc, char *argv [])
3131
{
3232
bool verbose = false;
3333
char *iface = NULL;
34+
char *endpoint = NULL;
35+
char *gossip = NULL;
3436
int ipv6 = 0;
3537
int curve = 0;
3638
int argn;
@@ -41,6 +43,8 @@ int main (int argc, char *argv [])
4143
puts (" --help / -h this help");
4244
puts (" --verbose / -v verbose test output");
4345
puts (" --interface / -i use this interface");
46+
puts (" --endpoint / -e set node endpoint");
47+
puts (" --gossip / -g connect to gossip endpoint");
4448
puts (" --ipv6 / -6 use IPv6");
4549
puts (" --curve / -c use CURVE encryption");
4650
return 0;
@@ -53,6 +57,14 @@ int main (int argc, char *argv [])
5357
|| streq (argv [argn], "-i"))
5458
iface = argv [++argn];
5559
else
60+
if (streq (argv [argn], "--endpoint")
61+
|| streq (argv [argn], "-e"))
62+
endpoint = argv [++argn];
63+
else
64+
if (streq (argv [argn], "--gossip")
65+
|| streq (argv [argn], "-g"))
66+
gossip = argv [++argn];
67+
else
5668
if (streq (argv [argn], "--ipv6")
5769
|| streq (argv [argn], "-6"))
5870
ipv6 = 1;
@@ -80,6 +92,19 @@ int main (int argc, char *argv [])
8092
zyre_set_verbose (zyre);
8193
if (iface)
8294
zyre_set_interface (zyre, iface);
95+
if (gossip) {
96+
zsys_info ("Connecting to gossip endpoint at %s", gossip);
97+
zyre_gossip_connect (zyre, "%s", gossip);
98+
}
99+
if (endpoint) {
100+
zsys_info ("Setting endpoint to %s", endpoint);
101+
int rc = zyre_set_endpoint (zyre, "%s", endpoint);
102+
if (rc != 0) {
103+
zsys_error ("Could not set endpoint '%s'", endpoint);
104+
zyre_destroy (&zyre);
105+
return 1;
106+
}
107+
}
83108
zactor_t *auth = NULL;
84109
#ifdef ZYRE_BUILD_DRAFT_API
85110
// DRAFT-API: Security

0 commit comments

Comments
 (0)