Skip to content

Commit 442c48e

Browse files
authored
Merge pull request #485 from thecodefactory/push-pull-rename
Rename xsub to puller and the publisher to pusher
2 parents 9432c21 + 50969c1 commit 442c48e

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

src/services/block_service.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,19 +73,19 @@ bool block_service::start()
7373
void block_service::work()
7474
{
7575
zmq::socket xpub(authenticator_, role::extended_publisher, external_);
76-
zmq::socket xsub(authenticator_, role::puller, internal_);
76+
zmq::socket puller(authenticator_, role::puller, internal_);
7777

7878
// Bind sockets to the service and worker endpoints.
79-
if (!started(bind(xpub, xsub)))
79+
if (!started(bind(xpub, puller)))
8080
return;
8181

8282
// TODO: tap in to failure conditions, such as high water.
8383
// BUGBUG: stop is insufficient to stop the worker, because of relay().
8484
// Relay messages between subscriber and publisher (blocks on context).
85-
relay(xpub, xsub);
85+
relay(xpub, puller);
8686

8787
// Unbind the sockets and exit this thread.
88-
finished(unbind(xpub, xsub));
88+
finished(unbind(xpub, puller));
8989
}
9090

9191
// Bind/Unbind.
@@ -176,11 +176,11 @@ void block_service::publish_blocks(uint32_t fork_height,
176176
if (stopped())
177177
return;
178178

179-
zmq::socket publisher(authenticator_, role::pusher, internal_);
179+
zmq::socket pusher(authenticator_, role::pusher, internal_);
180180

181181
// Subscriptions are off the pub-sub thread so this must connect back.
182182
// This could be optimized by caching the socket as thread static.
183-
const auto ec = publisher.connect(worker_);
183+
const auto ec = pusher.connect(worker_);
184184

185185
if (ec == error::service_stopped)
186186
return;
@@ -194,14 +194,14 @@ void block_service::publish_blocks(uint32_t fork_height,
194194
}
195195

196196
for (const auto block: *blocks)
197-
publish_block(publisher, ++fork_height, block);
197+
publish_block(pusher, ++fork_height, block);
198198
}
199199

200200
// [ height:4 ]
201201
// [ block ]
202202
// The payload for block publication is delimited within the zeromq message.
203203
// This is required for compatability and inconsistent with query payloads.
204-
void block_service::publish_block(zmq::socket& publisher, size_t height,
204+
void block_service::publish_block(zmq::socket& pusher, size_t height,
205205
block_const_ptr block)
206206
{
207207
if (stopped())
@@ -215,7 +215,7 @@ void block_service::publish_block(zmq::socket& publisher, size_t height,
215215
broadcast.enqueue_little_endian(static_cast<uint32_t>(height));
216216
broadcast.enqueue(block->to_data(bc::message::version::level::canonical));
217217

218-
const auto ec = publisher.send(broadcast);
218+
const auto ec = pusher.send(broadcast);
219219

220220
if (ec == error::service_stopped)
221221
return;

src/services/transaction_service.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,19 +72,19 @@ bool transaction_service::start()
7272
void transaction_service::work()
7373
{
7474
zmq::socket xpub(authenticator_, role::extended_publisher, external_);
75-
zmq::socket xsub(authenticator_, role::puller, internal_);
75+
zmq::socket puller(authenticator_, role::puller, internal_);
7676

7777
// Bind sockets to the service and worker endpoints.
78-
if (!started(bind(xpub, xsub)))
78+
if (!started(bind(xpub, puller)))
7979
return;
8080

8181
// TODO: tap in to failure conditions, such as high water.
8282
// BUGBUG: stop is insufficient to stop the worker, because of relay().
8383
// Relay messages between subscriber and publisher (blocks on context).
84-
relay(xpub, xsub);
84+
relay(xpub, puller);
8585

8686
// Unbind the sockets and exit this thread.
87-
finished(unbind(xpub, xsub));
87+
finished(unbind(xpub, puller));
8888
}
8989

9090
// Bind/Unbind.
@@ -175,11 +175,11 @@ void transaction_service::publish_transaction(transaction_const_ptr tx)
175175
if (stopped())
176176
return;
177177

178-
zmq::socket publisher(authenticator_, role::pusher, internal_);
178+
zmq::socket pusher(authenticator_, role::pusher, internal_);
179179

180180
// Subscriptions are off the pub-sub thread so this must connect back.
181181
// This could be optimized by caching the socket as thread static.
182-
auto ec = publisher.connect(worker_);
182+
auto ec = pusher.connect(worker_);
183183

184184
if (ec == error::service_stopped)
185185
return;
@@ -201,7 +201,7 @@ void transaction_service::publish_transaction(transaction_const_ptr tx)
201201
broadcast.enqueue_little_endian(++sequence_);
202202
broadcast.enqueue(tx->to_data(bc::message::version::level::canonical));
203203

204-
ec = publisher.send(broadcast);
204+
ec = pusher.send(broadcast);
205205

206206
if (ec == error::service_stopped)
207207
return;

0 commit comments

Comments
 (0)