Browse Source

remote_client -> socket_client; use logger

pull/1780/head
Ethan Buchman 9 years ago
parent
commit
d3bdb49aae
3 changed files with 51 additions and 43 deletions
  1. +2
    -3
      client/grpc_client.go
  2. +7
    -0
      client/log.go
  3. +42
    -40
      client/socket_client.go

+ 2
- 3
client/grpc_client.go View File

@ -1,7 +1,6 @@
package tmspcli package tmspcli
import ( import (
"fmt"
"net" "net"
"sync" "sync"
"time" "time"
@ -50,7 +49,7 @@ RETRY_LOOP:
if cli.mustConnect { if cli.mustConnect {
return err return err
} else { } else {
fmt.Printf("tmsp.grpcClient failed to connect to %v. Retrying...\n", cli.addr)
log.Warn(Fmt("tmsp.grpcClient failed to connect to %v. Retrying...\n", cli.addr))
time.Sleep(time.Second * 3) time.Sleep(time.Second * 3)
continue RETRY_LOOP continue RETRY_LOOP
} }
@ -75,7 +74,7 @@ func (cli *grpcClient) SetResponseCallback(resCb Callback) {
func (cli *grpcClient) StopForError(err error) { func (cli *grpcClient) StopForError(err error) {
cli.mtx.Lock() cli.mtx.Lock()
fmt.Printf("Stopping tmsp.grpcClient for error: %v\n", err.Error())
log.Warn(Fmt("Stopping tmsp.grpcClient for error: %v\n", err.Error()))
if cli.err == nil { if cli.err == nil {
cli.err = err cli.err = err
} }


+ 7
- 0
client/log.go View File

@ -0,0 +1,7 @@
package tmspcli
import (
"github.com/tendermint/go-logger"
)
var log = logger.New("module", "tmspcli")

client/remote_client.go → client/socket_client.go View File


Loading…
Cancel
Save