Browse Source

Conform to go-wire 1.0

pull/1780/head
Jae Kwon 9 years ago
parent
commit
d319c5be0d
3 changed files with 8 additions and 8 deletions
  1. +2
    -2
      cmd/cli.go
  2. +3
    -3
      example/main_test.go
  3. +3
    -3
      server/server.go

+ 2
- 2
cmd/cli.go View File

@ -115,13 +115,13 @@ func cmdRollback(c *cli.Context) {
//--------------------------------------------------------------------------------
func write(conn net.Conn, req types.Request) (types.Response, error) {
var n int64
var n int
var err error
wire.WriteBinary(req, conn, &n, &err)
if err != nil {
return nil, err
}
var res types.Response
wire.ReadBinaryPtr(&res, conn, &n, &err)
wire.ReadBinaryPtr(&res, conn, 0, &n, &err)
return res, err
}

+ 3
- 3
example/main_test.go View File

@ -27,10 +27,10 @@ func TestStream(t *testing.T) {
// Read response data
go func() {
for {
var n int64
var n int
var err error
var res types.Response
wire.ReadBinaryPtr(&res, conn, &n, &err)
wire.ReadBinaryPtr(&res, conn, 0, &n, &err)
if err != nil {
Exit(err.Error())
}
@ -40,7 +40,7 @@ func TestStream(t *testing.T) {
// Write requests
for {
var n int64
var n int
var err error
var req types.Request = types.RequestAppendTx{TxBytes: []byte("test")}
wire.WriteBinary(req, conn, &n, &err)


+ 3
- 3
server/server.go View File

@ -53,10 +53,10 @@ func handleRequests(app types.Application, connClosed chan struct{}, conn net.Co
var count int
var bufReader = bufio.NewReader(conn)
for {
var n int64
var n int
var err error
var req types.Request
wire.ReadBinaryPtr(&req, bufReader, &n, &err)
wire.ReadBinaryPtr(&req, bufReader, 0, &n, &err)
if err != nil {
fmt.Println("Error in handleRequests:", err.Error())
connClosed <- struct{}{}
@ -119,7 +119,7 @@ func handleResponses(connClosed chan struct{}, responses <-chan types.Response,
var bufWriter = bufio.NewWriter(conn)
for {
var res = <-responses
var n int64
var n int
var err error
wire.WriteBinary(res, bufWriter, &n, &err)
if err != nil {


Loading…
Cancel
Save