summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmir Taaki <genjix@riseup.net>2013-06-11 02:02:32 (GMT)
committer Amir Taaki <genjix@riseup.net>2013-06-11 02:02:32 (GMT)
commit9b5417b2acd353af612219c679242f1344b9ce34 (patch)
treec9034373f728b55c923711c65f68745979a39918
parent2ea794706ef2530da65c1b7252f92647c3cb7c55 (diff)
doc: updated fullnode tutorial.v1.0.2
-rw-r--r--doc/sphinx/examples/fullnode.rst2
-rw-r--r--doc/sphinx/fullnode.rst11
-rw-r--r--examples/fullnode.cpp2
3 files changed, 10 insertions, 5 deletions
diff --git a/doc/sphinx/examples/fullnode.rst b/doc/sphinx/examples/fullnode.rst
index a19145f..4964d0c 100644
--- a/doc/sphinx/examples/fullnode.rst
+++ b/doc/sphinx/examples/fullnode.rst
@@ -147,7 +147,7 @@ examples/fullnode.cpp
{
if (ec)
{
- log_warning() << "Connection started: " << ec.message();
+ log_warning() << "Couldn't start connection: " << ec.message();
return;
}
// Subscribe to transaction messages from this node.
diff --git a/doc/sphinx/fullnode.rst b/doc/sphinx/fullnode.rst
index 782af5c..744fefe 100644
--- a/doc/sphinx/fullnode.rst
+++ b/doc/sphinx/fullnode.rst
@@ -229,7 +229,7 @@ transaction memory pool with :func:`transaction_pool::store`.
// New connection has been started.
// Subscribe to new transaction messages from the network.
- void connection_started(channel_ptr node);
+ void connection_started(const std::error_code& ec, channel_ptr node);
// New transaction message from the network.
// Attempt to validate it by storing it in the transaction pool.
void recv_tx(const std::error_code& ec,
@@ -249,7 +249,7 @@ At the beginning of start, we subscribe to new connections.
{
// Subscribe to new connections.
protocol_.subscribe_channel(
- std::bind(&fullnode::connection_started, this, _1));
+ std::bind(&fullnode::connection_started, this, _1, _2));
// ...
}
@@ -261,12 +261,17 @@ connections.
void fullnode::connection_started(channel_ptr node)
{
+ if (ec)
+ {
+ log_warning() << "Couldn't start connection: " << ec.message();
+ return;
+ }
// Subscribe to transaction messages from this node.
node->subscribe_transaction(
std::bind(&fullnode::recv_tx, this, _1, _2, node));
// Stay subscribed to new connections.
protocol_.subscribe_channel(
- std::bind(&fullnode::connection_started, this, _1));
+ std::bind(&fullnode::connection_started, this, _1, _2));
}
Validating The Transaction
diff --git a/examples/fullnode.cpp b/examples/fullnode.cpp
index 0a0100b..914106c 100644
--- a/examples/fullnode.cpp
+++ b/examples/fullnode.cpp
@@ -144,7 +144,7 @@ void fullnode::connection_started(const std::error_code& ec, channel_ptr node)
{
if (ec)
{
- log_warning() << "Connection started: " << ec.message();
+ log_warning() << "Couldn't start connection: " << ec.message();
return;
}
// Subscribe to transaction messages from this node.