Skip to content

Commit 9daa765

Browse files
committed
Merge pull request #1015 from hintjens/master
Problem: zgossip_msg.txt should not be in doc directory
2 parents 4aca7b8 + c09a4d0 commit 9daa765

File tree

7 files changed

+22
-16
lines changed

7 files changed

+22
-16
lines changed

doc/zgossip.doc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,11 @@ This is the class interface:
126126
//
127127
// This is the zgossip constructor as a zactor_fn:
128128
//
129-
void
129+
CZMQ_EXPORT void
130130
zgossip (zsock_t *pipe, void *args);
131131

132132
// Self test of this class
133-
void
133+
CZMQ_EXPORT void
134134
zgossip_test (bool verbose);
135135

136136
This is the class self test code:

doc/zgossip.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ SYNOPSIS
5858
//
5959
// This is the zgossip constructor as a zactor_fn:
6060
//
61-
void
61+
CZMQ_EXPORT void
6262
zgossip (zsock_t *pipe, void *args);
6363

6464
// Self test of this class
65-
void
65+
CZMQ_EXPORT void
6666
zgossip_test (bool verbose);
6767
----
6868

doc/zgossip_msg.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

include/zgossip.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ extern "C" {
8080
//
8181
// This is the zgossip constructor as a zactor_fn:
8282
//
83-
void
83+
CZMQ_EXPORT void
8484
zgossip (zsock_t *pipe, void *args);
8585

8686
// Self test of this class
87-
void
87+
CZMQ_EXPORT void
8888
zgossip_test (bool verbose);
8989
// @end
9090

src/zgossip.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
script = "zproto_server_c"
55
protocol_class = "zgossip_msg"
66
project_header = "../include/czmq.h"
7+
export_macro = "CZMQ_EXPORT"
78
>
89
This is a server implementation of the ZeroMQ Gossip Discovery Protocol
910
<include filename = "license.xml" />
@@ -41,13 +42,13 @@
4142
<event name = "PING">
4243
<action name = "send" message = "PONG" />
4344
</event>
44-
45+
4546
<!-- All other protocol messages are invalid -->
4647
<event name = "*">
4748
<action name = "send" message = "INVALID" />
4849
<action name = "terminate" />
4950
</event>
50-
51+
5152
<!-- This built-in event hits on a client timeout -->
5253
<event name = "expired">
5354
<action name = "terminate" />

src/zgossip_engine.inc

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -213,21 +213,27 @@ engine_broadcast_event (server_t *server, client_t *client, event_t event)
213213
}
214214
}
215215

216-
// Poll socket for activity, invoke handler on any received message.
217-
// Handler must be a CZMQ zloop_fn function; receives server as arg.
216+
// Poll actor or zsock for activity, invoke handler on any received
217+
// message. Handler must be a CZMQ zloop_fn function; receives server
218+
// as arg.
218219

219220
static void
220-
engine_handle_socket (server_t *server, zsock_t *socket, zloop_reader_fn handler)
221+
engine_handle_socket (server_t *server, void *sock, zloop_reader_fn handler)
221222
{
222223
if (server) {
223224
s_server_t *self = (s_server_t *) server;
225+
// Resolve zactor_t -> zsock_t
226+
if (zactor_is (sock))
227+
sock = zactor_sock ((zactor_t *) sock);
228+
else
229+
assert (zsock_is (sock));
224230
if (handler != NULL) {
225-
int rc = zloop_reader (self->loop, socket, handler, self);
231+
int rc = zloop_reader (self->loop, (zsock_t *) sock, handler, self);
226232
assert (rc == 0);
227-
zloop_reader_set_tolerant (self->loop, socket);
233+
zloop_reader_set_tolerant (self->loop, (zsock_t *) sock);
228234
}
229235
else
230-
zloop_reader_end (self->loop, socket);
236+
zloop_reader_end (self->loop, (zsock_t *) sock);
231237
}
232238
}
233239

src/zgossip_msg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,6 @@ zgossip_msg_test (bool verbose)
602602
zgossip_msg_t *self = zgossip_msg_new ();
603603
assert (self);
604604
zgossip_msg_destroy (&self);
605-
606605
// Create pair of sockets we can send through
607606
// We must bind before connect if we wish to remain compatible with ZeroMQ < v4
608607
zsock_t *output = zsock_new (ZMQ_DEALER);
@@ -615,6 +614,7 @@ zgossip_msg_test (bool verbose)
615614
rc = zsock_connect (input, "inproc://selftest-zgossip_msg");
616615
assert (rc == 0);
617616

617+
618618
// Encode/send/decode and verify each message type
619619
int instance;
620620
self = zgossip_msg_new ();

0 commit comments

Comments
 (0)