Skip to content

Commit a351468

Browse files
committed
Merge pull request #320 from hintjens/master
Fix to #319
2 parents d4234f3 + 463d2a6 commit a351468

File tree

4 files changed

+88
-90
lines changed

4 files changed

+88
-90
lines changed

api/zyre.xml

Lines changed: 76 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<class name="zyre">
1+
<class name = "zyre">
22
An open-source framework for proximity-based P2P apps
33

44
<include filename = "../license.xml" />
@@ -8,57 +8,57 @@
88
node it is silent and invisible to other nodes on the network.
99
The node name is provided to other nodes during discovery. If you
1010
specify NULL, Zyre generates a randomized node name from the UUID.
11-
<argument name="name" type="string" />
11+
<argument name = "name" type = "string" />
1212
</constructor>
1313

1414
<destructor>
1515
Destructor, destroys a Zyre node. When you destroy a node, any
1616
messages it is sending or receiving will be discarded.
1717
</destructor>
1818

19-
<method name="uuid">
19+
<method name = "uuid">
2020
Return our node UUID string, after successful initialization
21-
<return type="string" />
21+
<return type = "string" />
2222
</method>
2323

24-
<method name="name">
24+
<method name = "name">
2525
Return our node name, after successful initialization
26-
<return type="string" />
26+
<return type = "string" />
2727
</method>
2828

29-
<method name="set_header">
29+
<method name = "set_header">
3030
Set node header; these are provided to other nodes during discovery
3131
and come in each ENTER message.
32-
<argument name="name" type="string" />
33-
<argument name="format" type="format" />
32+
<argument name = "name" type = "string" />
33+
<argument name = "format" type = "format" />
3434
</method>
3535

36-
<method name="set_verbose">
36+
<method name = "set_verbose">
3737
Set verbose mode; this tells the node to log all traffic as well as
3838
all major events.
3939
</method>
4040

41-
<method name="set_port">
41+
<method name = "set_port">
4242
Set UDP beacon discovery port; defaults to 5670, this call overrides
4343
that so you can create independent clusters on the same network, for
4444
e.g. development vs. production. Has no effect after zyre_start().
45-
<argument name="port_nbr" type="integer" />
45+
<argument name = "port_nbr" type = "integer" />
4646
</method>
4747

48-
<method name="set_interval">
48+
<method name = "set_interval">
4949
Set UDP beacon discovery interval, in milliseconds. Default is instant
5050
beacon exploration followed by pinging every 1,000 msecs.
51-
<argument name="interval" type="size" />
51+
<argument name = "interval" type = "size" />
5252
</method>
5353

54-
<method name="set_interface">
54+
<method name = "set_interface">
5555
Set network interface for UDP beacons. If you do not set this, CZMQ will
5656
choose an interface for you. On boxes with several interfaces you should
5757
specify which one you want to use, or strange things can happen.
58-
<argument name="value" type="string" />
58+
<argument name = "value" type = "string" />
5959
</method>
6060

61-
<method name="set_endpoint">
61+
<method name = "set_endpoint">
6262
By default, Zyre binds to an ephemeral TCP port and broadcasts the local
6363
host name using UDP beaconing. When you call this method, Zyre will use
6464
gossip discovery instead of UDP beaconing. You MUST set-up the gossip
@@ -67,132 +67,132 @@
6767
inproc://, ipc://, or tcp:// transports (for tcp://, use an IP address
6868
that is meaningful to remote as well as local nodes). Returns 0 if
6969
the bind was successful, else -1.
70-
<argument name="format" type="format" />
71-
<return type="integer" />
70+
<argument name = "format" type = "format" />
71+
<return type = "integer" />
7272
</method>
7373

74-
<method name="gossip_bind">
74+
<method name = "gossip_bind">
7575
Set-up gossip discovery of other nodes. At least one node in the cluster
7676
must bind to a well-known gossip endpoint, so other nodes can connect to
7777
it. Note that gossip endpoints are completely distinct from Zyre node
7878
endpoints, and should not overlap (they can use the same transport).
79-
<argument name="format" type="format" />
79+
<argument name = "format" type = "format" />
8080
</method>
8181

82-
<method name="gossip_connect">
82+
<method name = "gossip_connect">
8383
Set-up gossip discovery of other nodes. A node may connect to multiple
8484
other nodes, for redundancy paths. For details of the gossip network
8585
design, see the CZMQ zgossip class.
86-
<argument name="format" type="format" />
86+
<argument name = "format" type = "format" />
8787
</method>
8888

89-
<method name="start">
89+
<method name = "start">
9090
Start node, after setting header values. When you start a node it
9191
begins discovery and connection. Returns 0 if OK, -1 if it wasn't
9292
possible to start the node.
93-
<return type="integer" />
93+
<return type = "integer" />
9494
</method>
9595

96-
<method name="stop">
96+
<method name = "stop">
9797
Stop node; this signals to other peers that this node will go away.
9898
This is polite; however you can also just destroy the node without
9999
stopping it.
100100
</method>
101101

102-
<method name="join">
102+
<method name = "join">
103103
Join a named group; after joining a group you can send messages to
104104
the group and all Zyre nodes in that group will receive them.
105-
<argument name="group" type="string" />
106-
<return type="integer" />
105+
<argument name = "group" type = "string" />
106+
<return type = "integer" />
107107
</method>
108108

109-
<method name="leave">
109+
<method name = "leave">
110110
Leave a group
111-
<argument name="group" type="string" />
112-
<return type="integer" />
111+
<argument name = "group" type = "string" />
112+
<return type = "integer" />
113113
</method>
114114

115-
<method name="recv">
115+
<method name = "recv">
116116
Receive next message from network; the message may be a control
117117
message (ENTER, EXIT, JOIN, LEAVE) or data (WHISPER, SHOUT).
118118
Returns zmsg_t object, or NULL if interrupted
119-
<return type="zmsg" />
119+
<return type = "zmsg" />
120120
</method>
121121

122-
<method name="whisper">
122+
<method name = "whisper">
123123
Send message to single peer, specified as a UUID string
124124
Destroys message after sending
125-
<argument name="peer" type="string" />
126-
<argument name="msg_p" type="zmsg" by_reference="1" />
127-
<return type="integer" />
125+
<argument name = "peer" type = "string" />
126+
<argument name = "msg_p" type = "zmsg" by_reference = "1" />
127+
<return type = "integer" />
128128
</method>
129129

130-
<method name="shout">
130+
<method name = "shout">
131131
Send message to a named group
132132
Destroys message after sending
133-
<argument name="group" type="string" />
134-
<argument name="msg_p" type="zmsg" by_reference="1" />
135-
<return type="integer" />
133+
<argument name = "group" type = "string" />
134+
<argument name = "msg_p" type = "zmsg" by_reference = "1" />
135+
<return type = "integer" />
136136
</method>
137137

138-
<method name="whispers">
138+
<method name = "whispers">
139139
Send formatted string to a single peer specified as UUID string
140-
<argument name="peer" type="string" />
141-
<argument name="format" type="format" />
142-
<return type="integer" />
140+
<argument name = "peer" type = "string" />
141+
<argument name = "format" type = "format" />
142+
<return type = "integer" />
143143
</method>
144144

145-
<method name="shouts">
145+
<method name = "shouts">
146146
Send formatted string to a named group
147-
<argument name="group" type="string" />
148-
<argument name="format" type="format" />
149-
<return type="integer" />
147+
<argument name = "group" type = "string" />
148+
<argument name = "format" type = "format" />
149+
<return type = "integer" />
150150
</method>
151151

152-
<method name="peers">
153-
Return zlist of current peer ids.
154-
<return type="zlist" fresh="1" />
152+
<method name = "peers">
153+
Return zlist of current peer ids.
154+
<return type = "zlist" fresh = "1" />
155155
</method>
156156

157-
<method name="own_groups">
158-
Return zlist of currently joined groups.
159-
<return type="zlist" fresh="1" />
157+
<method name = "own_groups">
158+
Return zlist of currently joined groups.
159+
<return type = "zlist" fresh = "1" />
160160
</method>
161161

162-
<method name="peer_groups">
163-
Return zlist of groups known through connected peers.
164-
<return type="zlist" fresh="1" />
162+
<method name = "peer_groups">
163+
Return zlist of groups known through connected peers.
164+
<return type = "zlist" fresh = "1" />
165165
</method>
166166

167-
<method name="peer_address">
168-
Return the endpoint of a connected peer.
169-
<argument name="peer" type="string" />
170-
<return type="string" fresh="1" />
167+
<method name = "peer_address">
168+
Return the endpoint of a connected peer.
169+
<argument name = "peer" type = "string" />
170+
<return type = "string" fresh = "1" />
171171
</method>
172172

173-
<method name="peer_header_value">
173+
<method name = "peer_header_value">
174174
Return the value of a header of a conected peer.
175-
Returns null if peer or key doesn't exist.
176-
<argument name="peer" type="string" />
177-
<argument name="name" type="string" />
178-
<return type="string" fresh="1" />
175+
Returns null if peer or key doesn't exits.
176+
<argument name = "peer" type = "string" />
177+
<argument name = "name" type = "string" />
178+
<return type = "string" fresh = "1" />
179179
</method>
180180

181-
<method name="socket">
181+
<method name = "socket">
182182
Return socket for talking to the Zyre node, for polling
183-
<return type="zsock" />
183+
<return type = "zsock" />
184184
</method>
185185

186-
<method name="version" singleton="1">
186+
<method name = "version" singleton = "1">
187187
Return the Zyre version for run-time API detection
188-
<argument name="major" type="integer" by_reference="1" />
189-
<argument name="minor" type="integer" by_reference="1" />
190-
<argument name="patch" type="integer" by_reference="1" />
188+
<argument name = "major" type = "integer" by_reference = "1" />
189+
<argument name = "minor" type = "integer" by_reference = "1" />
190+
<argument name = "patch" type = "integer" by_reference = "1" />
191191
</method>
192192

193-
<method name="test" singleton="1">
193+
<method name = "test" singleton = "1">
194194
Self test of this class
195-
<argument name="verbose" type="boolean" />
195+
<argument name = "verbose" type = "boolean" />
196196
</method>
197197

198198
</class>

src/zyre.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -475,21 +475,19 @@ zyre_peer_address (zyre_t *self, const char *peer)
475475
}
476476

477477
// --------------------------------------------------------------------------
478-
// Return the value of a header of a conected peer.
479-
// Returns null if peer or key doesn't exits. Caller
480-
// owns the string
478+
// Return the value of a header of a conected peer. Returns null if peer
479+
// or key doesn't exits. Caller owns the string.
480+
481481
char *
482482
zyre_peer_header_value (zyre_t *self, const char *peer, const char *name)
483483
{
484484
assert (self);
485485
assert (peer);
486486
assert (name);
487-
char *value;
488487
zstr_sendm (self->actor, "PEER HEADER");
489488
zstr_sendm (self->actor, peer);
490489
zstr_send (self->actor, name);
491-
value = zstr_recv (self->actor);
492-
return value;
490+
return zstr_recv (self->actor);
493491
}
494492

495493
// --------------------------------------------------------------------------

src/zyre_peer.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ zyre_peer_connected (zyre_peer_t *self)
226226
// --------------------------------------------------------------------------
227227
// Return peer identity string
228228

229-
char *
229+
const char *
230230
zyre_peer_identity (zyre_peer_t *self)
231231
{
232232
assert (self);
@@ -237,7 +237,7 @@ zyre_peer_identity (zyre_peer_t *self)
237237
// --------------------------------------------------------------------------
238238
// Return peer connection endpoint
239239

240-
char *
240+
const char *
241241
zyre_peer_endpoint (zyre_peer_t *self)
242242
{
243243
assert (self);
@@ -285,7 +285,7 @@ zyre_peer_expired_at (zyre_peer_t *self)
285285
// --------------------------------------------------------------------------
286286
// Return peer name
287287

288-
char *
288+
const char *
289289
zyre_peer_name (zyre_peer_t *self)
290290
{
291291
assert (self);
@@ -366,7 +366,7 @@ zyre_peer_set_ready (zyre_peer_t *self, bool ready)
366366
// --------------------------------------------------------------------------
367367
// Get peer header value
368368

369-
char *
369+
const char *
370370
zyre_peer_header (zyre_peer_t *self, char *key, char *default_value)
371371
{
372372
assert (self);

src/zyre_peer.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,15 @@ bool
5454
zyre_peer_connected (zyre_peer_t *self);
5555

5656
// Return peer connection endpoint
57-
char *
57+
const char *
5858
zyre_peer_endpoint (zyre_peer_t *self);
5959

6060
// Send message to peer
6161
int
6262
zyre_peer_send (zyre_peer_t *self, zre_msg_t **msg_p);
6363

6464
// Return peer identity string
65-
char *
65+
const char *
6666
zyre_peer_identity (zyre_peer_t *self);
6767

6868
// Register activity at peer
@@ -78,7 +78,7 @@ int64_t
7878
zyre_peer_expired_at (zyre_peer_t *self);
7979

8080
// Return peer name
81-
char *
81+
const char *
8282
zyre_peer_name (zyre_peer_t *self);
8383

8484
// Set peer name
@@ -106,7 +106,7 @@ void
106106
zyre_peer_set_ready (zyre_peer_t *self, bool ready);
107107

108108
// Get peer header value
109-
char *
109+
const char *
110110
zyre_peer_header (zyre_peer_t *self, char *key, char *default_value);
111111

112112
// Get peer headers table

0 commit comments

Comments
 (0)