Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show more information on zyre_peer_connect failure #226

Merged
merged 3 commits into from
Aug 14, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 9 additions & 22 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,24 @@
# Zyre
# Travis CI script

language: c

# Build required ZeroMQ projects first
# Build-check-install all subprojects
before_script:
- sudo apt-get install uuid-dev

# libsodium
- git clone git://github.com/jedisct1/libsodium.git
- cd libsodium
- ./autogen.sh
- ./configure && make check
- sudo make install
- sudo ldconfig
- cd ..
- ( cd libsodium; ./autogen.sh; ./configure; make check; sudo make install; sudo ldconfig )

# libzmq
- git clone git://github.com/zeromq/libzmq.git
- cd libzmq
- ./autogen.sh
- ./configure && make check
- sudo make install
- sudo ldconfig
- cd ..
- ( cd libzmq; ./autogen.sh; ./configure; make check; sudo make install; sudo ldconfig )

# CZMQ
- git clone git://github.com/zeromq/czmq.git
- cd czmq
- ./autogen.sh
- ./configure && make check
- sudo make install
- sudo ldconfig
- cd ..
- ( cd czmq; ./autogen.sh; ./configure; make check; sudo make install; sudo ldconfig )

# Build and check libzre
script: ./autogen.sh && ./configure && make && make check
# Build and check this project
script:
- ./autogen.sh && ./configure && make && make check
- sudo make install
2 changes: 1 addition & 1 deletion src/zre_msg.bnf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The following ABNF grammar defines the work with ZRE messages:

; Greet a peer so it can connect back to us
hello = signature %d1 version sequence endpoint groups status name headers
signature = %xAA %xA0 ; two octets
signature = %xAA %xA1 ; two octets
version = number-1 ; Version number (2)
sequence = number-2 ; Cyclic sequence number
endpoint = string ; Sender connect endpoint
Expand Down
6 changes: 3 additions & 3 deletions src/zre_msg.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
@end
*/

#include <czmq.h>
#include "../include/zyre.h"
#include "../include/zre_msg.h"

// Structure of our class
Expand Down Expand Up @@ -262,7 +262,7 @@ zre_msg_decode (zmsg_t **msg_p)
self->ceiling = self->needle + zframe_size (frame);
uint16_t signature;
GET_NUMBER2 (signature);
if (signature != (0xAAA0 | 0))
if (signature != (0xAAA0 | 1))
goto empty; // Invalid signature

// Get message id and parse per message type
Expand Down Expand Up @@ -502,7 +502,7 @@ zre_msg_encode (zre_msg_t **self_p)
// Now serialize message into the frame
zframe_t *frame = zframe_new (NULL, frame_size);
self->needle = zframe_data (frame);
PUT_NUMBER2 (0xAAA0 | 0);
PUT_NUMBER2 (0xAAA0 | 1);
PUT_NUMBER1 (self->id);

switch (self->id) {
Expand Down
2 changes: 1 addition & 1 deletion src/zre_msg.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
title = "work with ZRE messages"
script = "zproto_codec_c"
header = "../include"
signature = "0"
include = "../include/zyre.h"
export = "ZYRE_EXPORT"
>
This is the ZRE protocol, version 2 draft, as defined by rfc.zeromq.org/spec:36/ZRE.
Expand Down
1 change: 1 addition & 0 deletions src/zyre_node.c
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,7 @@ zyre_node_require_peer (zyre_node_t *self, zuuid_t *uuid, const char *endpoint)
zhash_foreach (self->peers, zyre_node_purge_peer, (char *) endpoint);

peer = zyre_peer_new (self->peers, uuid);
assert (peer);
zyre_peer_set_origin (peer, self->name);
zyre_peer_set_verbose (peer, self->verbose);
zyre_peer_connect (peer, self->uuid, (char *) endpoint);
Expand Down
7 changes: 7 additions & 0 deletions src/zyre_peer.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,13 @@ zyre_peer_connect (zyre_peer_t *self, zuuid_t *from, char *endpoint)

// Connect through to peer node
rc = zsock_connect (self->mailbox, "%s", endpoint);
if (rc != 0) {
zsys_error ("(%s) cannot connect to endpoint=%s",
self->origin, endpoint);
// Don't really have any error handling yet; if connect
// fails, there's something wrong with connect endpoint?
assert (false);
}
assert (rc == 0);
if (self->verbose)
zsys_info ("(%s) connect to peer: endpoint=%s",
Expand Down