Commit Graph

64 Commits

Author SHA1 Message Date
Josh Rickmar
20e56d6eda Ask for block(dis)connected updates.
This removes the last notification that was being sent unsolicited.
Since it is no longer needed, the code to duplicate notifications to
all clients has been removed.
2014-01-17 16:38:16 -05:00
Josh Rickmar
bd98836a2b Fix several bugs in the RPC server shutdown.
The RPC server was performing some of the shutdown logic in the wrong
order, that is, logging the the server has shut down, waiting for all
server goroutines to finish, and then closing a channel to notify
server goroutines to stop.  These three items have been reversed to
fix a hang where goroutines currently being waited on had not shut
down because they did not receive the notification.

While here, the server waitgroup was incremented for a goroutine that
was running without it, another select statement was added to stop a
duplicate close (which never occured last commit when I added the
select statements), and the "stopping rescan" logging was moved to
debug to make the ^C shutdown logging nicer.
2014-01-14 22:53:07 -05:00
Josh Rickmar
d8227c2751 Only close websocket disconnected chan if still open.
A channel cannot be closed multiple times, so use a select statement
to only close the channel if it can not be read from.
2014-01-14 21:47:27 -05:00
Josh Rickmar
86600a0356 Remove punctuation from end of logging for consistency. 2014-01-14 16:41:32 -05:00
Josh Rickmar
051a9013ce Stop rescans when a websocket client disconnects.
Fixes #66.
2014-01-14 15:59:31 -05:00
Josh Rickmar
6abad1d8ac Change websocket handlers to return results.
This is the first step to fixing #66.
2014-01-14 13:15:22 -05:00
Josh Rickmar
cd3084afcd Rework the btcwallet connection.
This changes the protocol between btcd and btcwallet to follow
JSON-RPC specifications sending notifications as requests with an
empty ID.

The notification request context handling has been greatly cleaned up
now that IDs no longer need to be saved when sending notifications.
2014-01-09 14:03:00 -05:00
Dave Collins
462bc5a031 Update for recent btcscript API changes.
This commit changes all code which deals with extracting addresses from
scripts to use the btcscript API ExtractPkScriptAddrs which in turn makes
use of the new btcutil.Address interface.

This provides much cleaner code for dealing with arbitrary script
destinations which is extensible without having to churn the APIs if new
destination types are added.
2014-01-08 11:22:29 -06:00
David Hill
47c92c0e62 fix typo 2014-01-06 15:57:37 -05:00
Josh Rickmar
405eca4a44 Remove usage of deprecated address encode/decode API. 2014-01-03 13:22:28 -05:00
Dave Collins
aeec39c1ff Add 2014 to copyright dates. 2014-01-01 10:16:15 -06:00
Dave Collins
835cee229a Move RPC handler maps near the top of file.
Since the command to handler mappings are the most often modified and
referenced code in rpcserver.go and rpcwebsocket.go, move them near the
top of their respective files.
2013-12-31 14:48:50 -06:00
Dave Collins
9b166b3876 Remove wallet notifications chan from std commands.
This commit cleans up the standard RPC command hanlding a bit by removing
the websocket specific notification channel from the handlers.  This was
previously required because the sendrawtransaction, when called from a
websocket enabled connection, needs to add a notification for when the
transaction is mined.

This commit modifies that to instead implement a websocket extended
version of sendrawtransaction which invokes the standard handler and adds
the notification.  In addition, the main send was modified to first look
if the command has a websocket specific handler first, and then falls back
to standard commands, rather than the previous approach of first checking
for a standard command and falling through to websocket commands.  This
essentially allows websockets connections to extend commands with the same
name with additional functionality such as what was done in this commit.
2013-12-31 14:42:15 -06:00
Dave Collins
5ad6d543d6 Move RPC websocket code to its own file.
The rpcserver.go file is starting to get a bit unwieldy.  This commit
moves the separable websocket specific bits into a separate file named
rpcwebsocket.go.
2013-12-31 13:19:07 -06:00