Rename HttpPostMode conn param to HTTPPostMode.

This rename is to make golint happy.
This commit is contained in:
Dave Collins 2015-01-15 18:14:45 -06:00
parent c4bc5220bc
commit 774eb787a8
3 changed files with 17 additions and 17 deletions

View File

@ -16,7 +16,7 @@ func main() {
Host: "localhost:8332", Host: "localhost:8332",
User: "yourrpcuser", User: "yourrpcuser",
Pass: "yourrpcpass", Pass: "yourrpcpass",
HttpPostMode: true, // Bitcoin core only supports HTTP POST mode HTTPPostMode: true, // Bitcoin core only supports HTTP POST mode
DisableTLS: true, // Bitcoin core does not provide TLS by default DisableTLS: true, // Bitcoin core does not provide TLS by default
} }
// Notice the notification parameter is nil since notifications are // Notice the notification parameter is nil since notifications are

View File

@ -789,7 +789,7 @@ func (c *Client) sendRequest(jReq *jsonRequest) {
// the client running in HTTP POST mode or not. When running in HTTP // the client running in HTTP POST mode or not. When running in HTTP
// POST mode, the command is issued via an HTTP client. Otherwise, // POST mode, the command is issued via an HTTP client. Otherwise,
// the command is issued via the asynchronous websocket channels. // the command is issued via the asynchronous websocket channels.
if c.config.HttpPostMode { if c.config.HTTPPostMode {
c.sendPost(jReq) c.sendPost(jReq)
return return
} }
@ -876,7 +876,7 @@ func (c *Client) Disconnected() bool {
// //
// This function is safe for concurrent access. // This function is safe for concurrent access.
func (c *Client) doDisconnect() bool { func (c *Client) doDisconnect() bool {
if c.config.HttpPostMode { if c.config.HTTPPostMode {
return false return false
} }
@ -979,7 +979,7 @@ func (c *Client) start() {
// Start the I/O processing handlers depending on whether the client is // Start the I/O processing handlers depending on whether the client is
// in HTTP POST mode or the default websocket mode. // in HTTP POST mode or the default websocket mode.
if c.config.HttpPostMode { if c.config.HTTPPostMode {
c.wg.Add(1) c.wg.Add(1)
go c.sendPostHandler() go c.sendPostHandler()
} else { } else {
@ -1055,13 +1055,13 @@ type ConnConfig struct {
// called manually. // called manually.
DisableConnectOnNew bool DisableConnectOnNew bool
// HttpPostMode instructs the client to run using multiple independent // HTTPPostMode instructs the client to run using multiple independent
// connections issuing HTTP POST requests instead of using the default // connections issuing HTTP POST requests instead of using the default
// of websockets. Websockets are generally preferred as some of the // of websockets. Websockets are generally preferred as some of the
// features of the client such notifications only work with websockets, // features of the client such notifications only work with websockets,
// however, not all servers support the websocket extensions, so this // however, not all servers support the websocket extensions, so this
// flag can be set to true to use basic HTTP POST requests instead. // flag can be set to true to use basic HTTP POST requests instead.
HttpPostMode bool HTTPPostMode bool
// EnableBCInfoHacks is an option provided to enable compatiblity hacks // EnableBCInfoHacks is an option provided to enable compatiblity hacks
// when connecting to blockchain.info RPC server // when connecting to blockchain.info RPC server
@ -1182,7 +1182,7 @@ func New(config *ConnConfig, ntfnHandlers *NotificationHandlers) (*Client, error
var httpClient *http.Client var httpClient *http.Client
connEstablished := make(chan struct{}) connEstablished := make(chan struct{})
var start bool var start bool
if config.HttpPostMode { if config.HTTPPostMode {
ntfnHandlers = nil ntfnHandlers = nil
start = true start = true
@ -1222,7 +1222,7 @@ func New(config *ConnConfig, ntfnHandlers *NotificationHandlers) (*Client, error
if start { if start {
close(connEstablished) close(connEstablished)
client.start() client.start()
if !client.config.HttpPostMode && !client.config.DisableAutoReconnect { if !client.config.HTTPPostMode && !client.config.DisableAutoReconnect {
client.wg.Add(1) client.wg.Add(1)
go client.wsReconnectHandler() go client.wsReconnectHandler()
} }
@ -1246,7 +1246,7 @@ func (c *Client) Connect(tries int) error {
c.mtx.Lock() c.mtx.Lock()
defer c.mtx.Unlock() defer c.mtx.Unlock()
if c.config.HttpPostMode { if c.config.HTTPPostMode {
return ErrNotWebsocketClient return ErrNotWebsocketClient
} }
if c.wsConn != nil { if c.wsConn != nil {

View File

@ -666,7 +666,7 @@ func (r FutureNotifyBlocksResult) Receive() error {
// NOTE: This is a btcd extension and requires a websocket connection. // NOTE: This is a btcd extension and requires a websocket connection.
func (c *Client) NotifyBlocksAsync() FutureNotifyBlocksResult { func (c *Client) NotifyBlocksAsync() FutureNotifyBlocksResult {
// Not supported in HTTP POST mode. // Not supported in HTTP POST mode.
if c.config.HttpPostMode { if c.config.HTTPPostMode {
return newFutureError(ErrNotificationsNotSupported) return newFutureError(ErrNotificationsNotSupported)
} }
@ -714,7 +714,7 @@ func (r FutureNotifySpentResult) Receive() error {
// recreate the previous notification state on reconnect. // recreate the previous notification state on reconnect.
func (c *Client) notifySpentInternal(outpoints []btcjson.OutPoint) FutureNotifySpentResult { func (c *Client) notifySpentInternal(outpoints []btcjson.OutPoint) FutureNotifySpentResult {
// Not supported in HTTP POST mode. // Not supported in HTTP POST mode.
if c.config.HttpPostMode { if c.config.HTTPPostMode {
return newFutureError(ErrNotificationsNotSupported) return newFutureError(ErrNotificationsNotSupported)
} }
@ -737,7 +737,7 @@ func (c *Client) notifySpentInternal(outpoints []btcjson.OutPoint) FutureNotifyS
// NOTE: This is a btcd extension and requires a websocket connection. // NOTE: This is a btcd extension and requires a websocket connection.
func (c *Client) NotifySpentAsync(outpoints []*wire.OutPoint) FutureNotifySpentResult { func (c *Client) NotifySpentAsync(outpoints []*wire.OutPoint) FutureNotifySpentResult {
// Not supported in HTTP POST mode. // Not supported in HTTP POST mode.
if c.config.HttpPostMode { if c.config.HTTPPostMode {
return newFutureError(ErrNotificationsNotSupported) return newFutureError(ErrNotificationsNotSupported)
} }
@ -793,7 +793,7 @@ func (r FutureNotifyNewTransactionsResult) Receive() error {
// NOTE: This is a btcd extension and requires a websocket connection. // NOTE: This is a btcd extension and requires a websocket connection.
func (c *Client) NotifyNewTransactionsAsync(verbose bool) FutureNotifyNewTransactionsResult { func (c *Client) NotifyNewTransactionsAsync(verbose bool) FutureNotifyNewTransactionsResult {
// Not supported in HTTP POST mode. // Not supported in HTTP POST mode.
if c.config.HttpPostMode { if c.config.HTTPPostMode {
return newFutureError(ErrNotificationsNotSupported) return newFutureError(ErrNotificationsNotSupported)
} }
@ -842,7 +842,7 @@ func (r FutureNotifyReceivedResult) Receive() error {
// recreate the previous notification state on reconnect. // recreate the previous notification state on reconnect.
func (c *Client) notifyReceivedInternal(addresses []string) FutureNotifyReceivedResult { func (c *Client) notifyReceivedInternal(addresses []string) FutureNotifyReceivedResult {
// Not supported in HTTP POST mode. // Not supported in HTTP POST mode.
if c.config.HttpPostMode { if c.config.HTTPPostMode {
return newFutureError(ErrNotificationsNotSupported) return newFutureError(ErrNotificationsNotSupported)
} }
@ -866,7 +866,7 @@ func (c *Client) notifyReceivedInternal(addresses []string) FutureNotifyReceived
// NOTE: This is a btcd extension and requires a websocket connection. // NOTE: This is a btcd extension and requires a websocket connection.
func (c *Client) NotifyReceivedAsync(addresses []btcutil.Address) FutureNotifyReceivedResult { func (c *Client) NotifyReceivedAsync(addresses []btcutil.Address) FutureNotifyReceivedResult {
// Not supported in HTTP POST mode. // Not supported in HTTP POST mode.
if c.config.HttpPostMode { if c.config.HTTPPostMode {
return newFutureError(ErrNotificationsNotSupported) return newFutureError(ErrNotificationsNotSupported)
} }
@ -939,7 +939,7 @@ func (c *Client) RescanAsync(startBlock *wire.ShaHash,
outpoints []*wire.OutPoint) FutureRescanResult { outpoints []*wire.OutPoint) FutureRescanResult {
// Not supported in HTTP POST mode. // Not supported in HTTP POST mode.
if c.config.HttpPostMode { if c.config.HTTPPostMode {
return newFutureError(ErrNotificationsNotSupported) return newFutureError(ErrNotificationsNotSupported)
} }
@ -1016,7 +1016,7 @@ func (c *Client) RescanEndBlockAsync(startBlock *wire.ShaHash,
endBlock *wire.ShaHash) FutureRescanResult { endBlock *wire.ShaHash) FutureRescanResult {
// Not supported in HTTP POST mode. // Not supported in HTTP POST mode.
if c.config.HttpPostMode { if c.config.HTTPPostMode {
return newFutureError(ErrNotificationsNotSupported) return newFutureError(ErrNotificationsNotSupported)
} }