Commit Graph

70 Commits

Author SHA1 Message Date
Tamir Duberstein 9871e09f09
Use codes.Code.String() rather than logging integers
This produces better human-readable error messages.
2017-02-27 14:13:02 -05:00
Yuxuan Li 6810d34606 fix issue #1056 and #1050 2017-02-13 17:37:53 -08:00
Mahak Mukhi dfb494c6e5 post review update 2017-02-08 14:15:59 -08:00
Mahak Mukhi 66de296a37 post review update 2017-02-07 14:46:28 -08:00
Mahak Mukhi 794873f0a2 Added calloption to retrieve peer information 2017-02-07 10:41:32 -08:00
Mark D. Roth 6e0ace39fe Change max message size fields from uint64 to uint32. 2017-01-26 14:43:08 -08:00
Mark D. Roth 325a0c2061 Update comment. 2017-01-09 12:59:10 -08:00
Qi Zhao 09aecb094e Add the initial service config support (#1009)
* Add the initial service config support

* start scWatcher later

* remove timeoutCh

* address the comments

* deal with dial timeout

* defer cancel for the newly created context for correct lifetime management

* fix the defer order

* added other 2 missing cancels
2016-12-19 16:31:00 -08:00
Menghan Li 3f9a96ea71 move inPayload.RecvTime to after unmarshal 2016-11-07 16:29:25 -08:00
Menghan Li 5938492b60 fix comments 2016-11-07 15:16:52 -08:00
Menghan Li a4edc462a2 renaming 2016-11-07 15:16:52 -08:00
Menghan Li c698588285 Renaming types and variables 2016-11-07 15:16:52 -08:00
Menghan Li 1054f1c42b add payload with original type to payload stats 2016-11-07 15:16:52 -08:00
Menghan Li 17ee5a3637 Add package stats, and export stats on server side. 2016-11-07 15:16:52 -08:00
Mak Mukhi 727a60e4d1 update server reflection code to comply with the change to the grpc generator 2016-10-21 18:06:55 -07:00
Menghan Li 5e734ab23e Avoid creating transport stream error outside of transport 2016-09-02 11:57:42 -07:00
iamqizhao fc500c24f6 fix go vet error 2016-07-29 18:08:00 -07:00
iamqizhao b13920a0cf add the mem alloc guard on server 2016-07-29 16:19:20 -07:00
iamqizhao 8c908a8c1d Reject over-sized requests on server 2016-07-26 16:44:49 -07:00
Menghan Li ffdfb592e8 Fix type assertion error after rebase 2016-07-08 10:35:38 -07:00
Daniel Ruehle 3802318f46 Make Errorf return pointer to rpcError 2016-07-08 10:28:36 -07:00
iamqizhao be59d023f2 refactor error handling a bit 2016-06-29 15:21:44 -07:00
iamqizhao 213a20c4fe bug fix, typo fix and slight error refactoring 2016-06-28 16:08:19 -07:00
iamqizhao 01ef81a4d9 minor fix including removal of debugging logs, error code fix, etc. 2016-06-27 15:30:20 -07:00
iamqizhao 3e71fb360d Support fail-fast mode and make it the default 2016-06-27 14:36:59 -07:00
Menghan Li cf04b299b7 Change SupportPackageIsVersion variable 2016-06-10 11:48:20 -07:00
joe2far 487ada6517 Fixed typos in docstrings 2016-06-07 12:01:07 +01:00
iamqizhao e0f9f26e85 remove the checking of empty string for recvCompress 2016-05-11 11:01:26 -07:00
iamqizhao b506f13d5b change the error code when the required decompressor is not installed 2016-05-11 10:46:23 -07:00
iamqizhao 113bf2f219 Change some compression related error code 2016-05-10 13:54:10 -07:00
iamqizhao 61e92eacc3 Phase 1 to add the server interceptor 2016-04-18 16:18:34 -07:00
Qi Zhao d07d0562ff Merge pull request #601 from stevvooe/backoff-strategy
backoff: allow configuration of backoff strategy
2016-04-11 10:32:33 -07:00
Stephen J Day 47b74a63a8 backoff: allow configuration of backoff strategy
The backoff function and parameters have been pulled up into an
interface `backoffStrategy`. The default parameters are now part of a
package variable `DefaultBackoffConfig`. The strategy is then plumbed
through `dialOptions`. As a result of this PR, the
maximum backoff delay can now be set using the `WithBackoffConfig` dial
option.

While the addition of strategy may seem premature, this allows one to
simply export `BackoffStrategy` and `WithBackoff` to allow arbirarily
configurable backoff strategies.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2016-04-07 20:17:57 -07:00
Menghan Li 71e3dbec56 Use ErrorDetail() to provide better error msg for malformed HTTP2 2016-03-28 11:34:29 -07:00
David Symonds 710dbc764f Prepare for adding a compatibility marker to proto generated code.
This will assert at build time that the generated code is compatible
with the grpc package that it is linked to. A future change in the
grpc plugin for protoc-gen-go will generate a line like
	const _ = grpc.SupportPackageIsVersion1

This constant will be renamed in the future when incompatible changes
are made that require synchronised updates to grpc and protoc-gen-go.
2016-03-07 10:12:28 +11:00
Brad Fitzpatrick 110fd99e30 Fix crashes where transports returned errors unhandled by the message parser.
The http.Handler-based transport body reader was returning error types
not understood by the recvMsg parser. See #557 for some background and
examples.

Fix the http.Handler transport and add tests. I copied in a subset of
the http2 package's serverTest type, adapted slightly to work with
grpc. In the process of adding tests, I discovered that
ErrUnexpectedEOF was also not handled by the regular server
transport. Document the rules and fix that crash as well.

Unrelated stuff in this CL:

* make tests listen on localhost:0 instead of :0, to avoid Mac firewall
  pop-up dialogs.

* rename parser.s field to parser.r, to be more idiomatic that it's an
  io.Reader and not anything fancier. (it's not acting like type
  stream, even if that's the typical concrete type)

* move 5 byte temp buffer into parser, rather than allocating it for
  each new message. (drop in the bucket improvement in garbage; more
  to do later)

* rename http2RSTErrConvTab to http2ErrConvTab, per Qi's earlier
  CL. Also add the HTTP/1.1-required error mapping for completeness,
  not that it should ever arise with gRPC, also per Qi's earlier CL
  referenced in #557.
2016-02-24 15:09:17 -08:00
Brad Fitzpatrick 7346c871b0 Add a ServeHTTP method to *grpc.Server
This adds new http.Handler-based ServerTransport in the process,
reusing the HTTP/2 server code in x/net/http2 or Go 1.6+.

All end2end tests pass with this new ServerTransport.

Fixes grpc/grpc-go#75

Also:
Updates grpc/grpc-go#495 (lets user fix it with middleware in front)
Updates grpc/grpc-go#468 (x/net/http2 validates)
Updates grpc/grpc-go#147 (possible with x/net/http2)
Updates grpc/grpc-go#104 (x/net/http2 does this)
2016-02-12 00:16:28 +00:00
iamqizhao af8888dc8d remove Compressor/DecompressorGenerator 2016-01-29 14:38:20 -08:00
iamqizhao 61d7c39d4c comments and gofmt 2016-01-25 11:18:41 -08:00
iamqizhao da3bb0c9f7 Support compression 2016-01-22 18:21:41 -08:00
iamqizhao ea6e7189de Move callInfo into the right position 2016-01-07 14:44:36 -08:00
Justin Nuß da435e3a08 Keep length as uint for overflow check 2015-10-22 12:21:04 +02:00
Justin Nuß cbdc43cf9a Fix variable name in comment 2015-10-21 20:47:16 +02:00
Justin Nuß 20ed1e924e Replace bytes.Buffer with properly sized []byte in encode 2015-10-21 20:47:16 +02:00
iamqizhao 984280ba37 change the type of length 2015-10-15 13:22:54 -07:00
iamqizhao 61c1259226 some cleanup 2015-10-15 10:59:39 -07:00
David Symonds d3cb35a50a 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.
2015-10-15 18:56:48 +11:00
Qi Zhao 6c8d213d08 Merge pull request #385 from nuss-justin/master
Avoid some allocations in recvMsg
2015-10-06 22:39:18 -07:00
Justin Nuß e2cb78fabb Combine const declarations into one block 2015-10-07 06:37:58 +02:00
iamqizhao e63d714a45 fix the wrong reference link 2015-10-06 16:05:45 -07:00