Skip to content

Commit

Permalink
Problem: zyre_get_peer_name is inconsistent and unnecessary
Browse files Browse the repository at this point in the history
The method name should be "zyre_peer_name" to be consistent with other
similar methods. However that conflicts with an internal zyre_peer
method.

At the same time this method isn't needed since the peer name is sent
along with the ENTER event.

Solution: remove this method.
  • Loading branch information
hintjens committed Jan 30, 2015
1 parent 88091f0 commit 777c78a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 29 deletions.
10 changes: 2 additions & 8 deletions include/zyre.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,15 +165,9 @@ ZYRE_EXPORT zlist_t *
ZYRE_EXPORT zlist_t *
zyre_peer_groups (zyre_t *self);

// Return the endpoint of a connected peer. Caller owns the
// string.
// Return the endpoint of a connected peer. Caller owns the string.
ZYRE_EXPORT char *
zyre_peer_address(zyre_t *self, const char *peer);

// Return the name of a connected peer. Caller owns the
// string.
ZYRE_EXPORT char *
zyre_get_peer_name(zyre_t *self, const char *peer);
zyre_peer_address (zyre_t *self, const char *peer);

// Return the value of a header of a conected peer.
// Returns null if peer or key doesn't exits. Caller
Expand Down
23 changes: 2 additions & 21 deletions src/zyre.c
Original file line number Diff line number Diff line change
Expand Up @@ -461,11 +461,10 @@ zyre_peers (zyre_t *self)
}

// --------------------------------------------------------------------------
// Return the endpoint of a connected peer. Caller owns the
// string.
// Return the endpoint of a connected peer. Caller owns the string.

char *
zyre_peer_address(zyre_t *self, const char *peer)
zyre_peer_address (zyre_t *self, const char *peer)
{
assert (self);
char *address;
Expand All @@ -475,21 +474,6 @@ zyre_peer_address(zyre_t *self, const char *peer)
return address;
}

// --------------------------------------------------------------------------
// Return the name of a connected peer. Caller owns the
// string.

char *
zyre_get_peer_name(zyre_t *self, const char *peer)
{
assert (self);
char *address;
zstr_sendm (self->actor, "PEER NAME");
zstr_send (self->actor, peer);
zsock_recv (self->actor, "s", &address);
return address;
}

// --------------------------------------------------------------------------
// Return the value of a header of a conected peer.
// Returns null if peer or key doesn't exits. Caller
Expand Down Expand Up @@ -670,9 +654,6 @@ zyre_test (bool verbose)
char *name = zmsg_popstr (msg);
assert (streq (name, "node1"));
zstr_free (&name);
char *peer_name = zyre_get_peer_name(node2, peerid);
assert (streq (peer_name, "node1"));
zstr_free (&peer_name);
zframe_t *headers_packed = zmsg_pop (msg);

char *address = zmsg_popstr (msg);
Expand Down

0 comments on commit 777c78a

Please sign in to comment.