Fix decoding of message headers for messages with lengths >= 2^24.

recvMsg was interpreting buf[1] as the payload format instead of buf[0];
since compressionNone (the only thing supported) == 0, recvMsg got lucky
for message lengths under 2^24, which has buf[1] == 0.

Fix the error, and ditch the constants in recvMsg. I think they were the
cause of the bug.

Also make encode fail more clearly if someone tries to transmit a
message that exceeds 2^32 bytes.

Fixes #399.
2 files changed
tree: a23a2acf90c1e97140b0200a5d571eca3e3b68df
  1. benchmark/
  2. codes/
  3. credentials/
  4. Documentation/
  5. examples/
  6. grpclog/
  7. health/
  8. interop/
  9. metadata/
  10. naming/
  11. test/
  12. transport/
  13. .travis.yml
  14. call.go
  15. clientconn.go
  16. codegen.sh
  17. CONTRIBUTING.md
  18. doc.go
  19. LICENSE
  20. Makefile
  21. PATENTS
  22. picker.go
  23. README.md
  24. rpc_util.go
  25. rpc_util_test.go
  26. server.go
  27. stream.go
  28. trace.go
README.md

#gRPC-Go

Build Status GoDoc

The Go implementation of gRPC: A high performance, open source, general RPC framework that puts mobile and HTTP/2 first. For more information see the gRPC Quick Start guide.

Installation

To install this package, you need to install Go 1.4 or above and setup your Go workspace on your computer. The simplest way to install the library is to run:

$ go get google.golang.org/grpc

Prerequisites

This requires Go 1.4 or above.

Constraints

The grpc package should only depend on standard Go packages and a small number of exceptions. If your contribution introduces new dependencies which are NOT in the list, you need a discussion with gRPC-Go authors and consultants.

Documentation

See API documentation for package and API descriptions and find examples in the examples directory.

Status

Beta release