Commit Graph

331 Commits

Author SHA1 Message Date
Menghan Li e790079956 Add grpc.SetHeader and ServerStream.SetHeader 2016-10-11 13:58:16 -07:00
Menghan Li 1247834778 Allow multiple calls to setTrailer 2016-09-29 14:38:20 -07:00
Menghan Li 1c20514d29 Make grpc.SendHeader return rpc error 2016-09-09 11:36:01 -07:00
Qi Zhao 8d57dd3404 Merge pull request #874 from menghanl/avoid_streamerror
Fix server side errors
2016-09-02 14:30:07 -07:00
Eric Drechsel 3bea3c5f8b Doc: Fix typo in func (s *Server) comment 2016-09-02 12:20:15 -07:00
Menghan Li 5e734ab23e Avoid creating transport stream error outside of transport 2016-09-02 11:57:42 -07:00
Menghan Li 0c58a17d6f Add credentials ErrConnDispatch 2016-08-24 16:20:57 -07:00
iamqizhao bcbb6549ac Merge branch 'master' of https://github.com/grpc/grpc-go 2016-07-29 16:20:08 -07:00
iamqizhao b13920a0cf add the mem alloc guard on server 2016-07-29 16:19:20 -07:00
iamqizhao 0f3fc4355d refactor GracefulStop a bit 2016-07-29 10:59:24 -07:00
iamqizhao a4c08780d5 Merge branch 'master' of https://github.com/grpc/grpc-go 2016-07-29 10:10:58 -07:00
Tamir Duberstein 069ed42115
Fix deadlock when GracefulStop()ing multiple times
Fixes #793.
2016-07-29 12:26:26 -04:00
iamqizhao b128e7465a merge the conflict 2016-07-28 13:17:23 -07:00
iamqizhao c3a89f91a6 Merge branch 'master' of https://github.com/grpc/grpc-go 2016-07-28 13:04:50 -07:00
Tamir Duberstein ac90a026b6
*: go vet 2016-07-27 23:39:19 -04:00
iamqizhao 110450d45e fix races introduce by goaway 2016-07-27 17:27:10 -07:00
iamqizhao 8c908a8c1d Reject over-sized requests on server 2016-07-26 16:44:49 -07:00
iamqizhao f78100723d Merge branch 'master' of https://github.com/grpc/grpc-go 2016-07-26 14:04:25 -07:00
iamqizhao b071b83367 limit max msg size on server 2016-07-26 14:04:19 -07:00
iamqizhao f1e4d3b180 allow multiple GoAways and retrying on illegal streams 2016-07-25 16:35:32 -07:00
iamqizhao 046e606dc5 clean up 2016-07-21 18:12:01 -07:00
iamqizhao 9ad4c58355 Make it work for streaming 2016-07-21 16:19:34 -07:00
iamqizhao 873cc272c2 support goaway 2016-07-20 18:48:49 -07:00
Qi Zhao 7428593149 Merge pull request #759 from menghanl/streams_in_serviceinfo_comments
Fix comments
2016-07-14 10:55:28 -07:00
Alexander Morozov 47de9c3564 server: close only non-closed listeners
The listener can be closed twice: in Close and in Serve. It might lead to
pretty bad things, for example, https://golang.org/src/net/unixsock_posix.go#L340
can delete a file which created by another listener.

Signed-off-by: Alexander Morozov <lk4d4math@gmail.com>
2016-07-12 21:16:45 -07:00
Menghan Li 42a2879989 Modify comments 2016-07-11 16:25:52 -07:00
Menghan Li bc8885608f Merge unary RPC info and streaming RPC info 2016-07-11 13:09:50 -07:00
Menghan Li 0ea9f970c0 Add StreamInfo for streaming types 2016-07-11 12:09:05 -07:00
Menghan Li a518fa911d Split methods and streams in service info 2016-07-11 12:09:05 -07:00
Daniel Ruehle 3802318f46 Make Errorf return pointer to rpcError 2016-07-08 10:28:36 -07:00
Menghan Li 078c90026f Minor fixes 2016-06-27 14:51:09 -07:00
Menghan Li 26d2db5487 Add server.GetServiceInfo().
To replace server.ServiceMetadata() and server.AllServiceNames().
2016-06-27 12:01:05 -07:00
Menghan Li 69c7425a21 Change server.ServiceMetadata to take service name and method name.
And some minor changes.
2016-06-27 12:01:05 -07:00
Menghan Li efe8d5f0f7 Add function AllServiceNames() to Server 2016-06-27 12:01:05 -07:00
Menghan Li e826825578 Add function Metadata() to Server 2016-06-27 12:01:05 -07:00
Menghan Li ad71085be9 Add metadata when registering service 2016-06-27 12:01:05 -07:00
Qi Zhao 3efe7aef96 Merge pull request #713 from menghanl/split_authenticator_and_credentials
[API revision] Separate TransportAuthenticator and PerRPCCredentials
2016-06-09 14:57:55 -07:00
Menghan Li 59486d9c17 Rename TransportAuthenticator to TransportCredentials 2016-06-08 11:19:25 -07:00
Menghan Li 7233968957 Add Metadata field to ServiceDesc 2016-06-07 15:40:14 -07:00
Menghan Li 6404c49192 Make TransportAuthenticator not embed Credentials 2016-06-06 16:24:46 -07:00
Qi Zhao aecdccadd2 Merge pull request #683 from mwitkow/feature/propagate-authority
make :authority propagate to MD
2016-06-01 18:18:23 -07:00
Qi Zhao 89e77e914d Merge pull request #706 from menghanl/fix_golint
Fix golint
2016-06-01 18:12:45 -07:00
Menghan Li fc590f40e9 Fix golint errors 2016-06-01 16:40:26 -07:00
Ben Darnell bab01e8e85 Fix a listener leak when a server is stopped before it starts
If server.Stop() and server.Serve() race, Serve() can return without
closing the listener. This in turn can lead to clients timing out trying
to connect to a server that is neither accepting nor rejecting
connections.
2016-05-22 14:52:40 -04:00
Michal Witkowski 1ef2c5293f fix `TestCompressOK` and client reserved HTTP header handling 2016-05-17 14:35:18 +01:00
iamqizhao e4bb85b43f Support the stream interceptor on server side. 2016-04-21 14:58:45 -07:00
iamqizhao 616cb8ecfe Add the missing comment 2016-04-19 16:33:09 -07:00
iamqizhao 310ca08496 gofmt -w 2016-04-19 16:04:09 -07:00
iamqizhao c321387fd9 the installation of server unary interceptor 2016-04-19 15:54:30 -07:00
iamqizhao 61e92eacc3 Phase 1 to add the server interceptor 2016-04-18 16:18:34 -07:00
Qi Zhao fea7689493 Merge pull request #584 from bradfitz/h2
Simplify server setup when testing the http.Handler-based server transport
2016-03-02 10:59:35 -08:00
Brad Fitzpatrick 18b2da6250 Simplify server setup when testing the http.Handler-based server transport
This simplifies the code that's used for wiring up the http.Handler-based
transport for testing. It's not used outside of tests.

http2.Server.ServeConn was added somewhat recently for other reasons and
I just realized it would simplify this code as well.
2016-03-02 18:49:23 +00:00
Brad Fitzpatrick 0f80f5b995 Remove test-only methods from grpc package.
Move the test-only methods to a new internal package so as to not
pollute the godoc, and to prevent people from using them. (Packages
named internal or under internal are private, and enforced by the go
tool)
2016-02-25 13:30:19 -08:00
Qi Zhao 89f694edb4 Merge pull request #569 from bradfitz/error_map
Fix crashes where transports returned errors unhandled by the message parser
2016-02-24 18:22:25 -08: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
Paul Querna 75fe76716d log error message and source address in handshake error 2016-02-23 11:14:03 -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
Brad Fitzpatrick 07d3de883f Update Server.Stop docs per code review comments from grpc/grpc-go#540 2016-02-09 23:50:03 +00:00
iamqizhao 854ad3492a refine the comments of grpc.Server.Stop() 2016-02-09 15:22:53 -08:00
iamqizhao 77ccaa8fb2 Close ServerTransport instead of the raw connection 2016-02-08 14:27:06 -08:00
Qi Zhao 93591e7568 Merge pull request #508 from bradfitz/master
server: break up the Server.Serve method into some reusable parts
2016-01-29 15:51:48 -08:00
Brad Fitzpatrick 9d2ecf553a server: break up the Server.Serve method into some reusable parts
Updates grpc/grpc-go#75
2016-01-29 23:20:54 +00:00
iamqizhao af8888dc8d remove Compressor/DecompressorGenerator 2016-01-29 14:38:20 -08:00
iamqizhao 9ec0eadc55 fix a nil map access bug 2016-01-28 18:51:38 -08:00
iamqizhao 35db64de36 Tune the server accepting code 2016-01-28 15:59:36 -08:00
iamqizhao 48d3f37c1f remove some commented code left from previous PR 2016-01-26 16:21:22 -08:00
iamqizhao 4258b32de7 Don't create buffer if compressor is nil 2016-01-25 11:47:04 -08:00
iamqizhao da3bb0c9f7 Support compression 2016-01-22 18:21:41 -08:00
iamqizhao 7aa428f5d6 Finish trace for premature error 2015-11-30 16:41:52 -08:00
iamqizhao 63a6c4155a remove sync.WaitGroup param from ServerTransport.HandleStream 2015-10-06 16:44:30 -07:00
iamqizhao 9db3ca85c7 gofmt -w 2015-10-05 17:52:00 -07:00
iamqizhao bc49d12737 refactor servier side trace again 2015-10-05 17:49:53 -07:00
iamqizhao 2aad9ba05f server side tracing refactoring 2015-10-02 15:06:41 -07:00
iamqizhao d77716f7d0 Merge branch 'master' of https://github.com/grpc/grpc-go 2015-10-02 10:29:54 -07:00
iamqizhao ffba849039 add the missing commit in previous PR 2015-10-01 18:20:59 -07:00
iamqizhao d12126f864 show deadline on server side trace 2015-10-01 18:08:09 -07:00
iamqizhao 00c7deef34 show deadline on server side trace 2015-10-01 18:07:38 -07:00
iamqizhao 09cdff2d62 Merge branch 'master' of https://github.com/grpc/grpc-go 2015-10-01 17:55:23 -07:00
iamqizhao 2bd5f5b1e1 show RemoteAddr in server trace 2015-10-01 17:43:05 -07:00
iamqizhao 3833326f9f Merge branch 'master' of https://github.com/grpc/grpc-go 2015-10-01 17:25:03 -07:00
iamqizhao d84ff12005 trace refactoring 2015-10-01 17:24:39 -07:00
iamqizhao a15e3b9562 decodeFunc -> dec 2015-10-01 16:26:00 -07:00
iamqizhao a71db53441 remove slice param 2015-09-29 20:10:20 -07:00
iamqizhao a27bb5b14a remove dead code 2015-09-29 19:08:55 -07:00
iamqizhao ce2ef8c969 Enable payload tracing for unary rpc 2015-09-29 19:05:13 -07:00
Qi Zhao e07e93b00e Merge pull request #358 from Sajmani/work
grpc: make trace.FromContext work, and record handler status in traces
2015-09-28 23:29:59 -07:00
Sameer Ajmani 86db82df28 add TODO to fix trace 2015-09-28 10:22:26 -04:00
iamqizhao d39eb0802f bug fix: do not access RemoteAddr on nil net.Conn 2015-09-24 18:44:03 -07:00
iamqizhao efb129eb20 bug fix: do not access RemoteAddr on nil net.Conn 2015-09-24 18:41:56 -07:00
iamqizhao 60c363f984 bug fix: do not access RemoteAddr on nil net.Conn 2015-09-24 18:39:38 -07:00
Sameer Ajmani ee98c48bb4 Incorporate dsymonds' comments.
Fix another bug: cancel the Context provided to an RPC server handler
as soon as that handler returns, so that goroutines started by that
handler can detect that the handler is done and exit. Without this
fix, goroutines started by a handler will keep running, unless the
handler itself arranges to cancel the context.
2015-09-23 22:17:37 -04:00
Sameer Ajmani b6c9c5a70f grpc: record the description of the status returned by server RPC
handlers in request traces, and mark the trace as an error if the
status is not OK.

Install the trace into the Context passed to server handlers using
trace.NewContext, so that code in the server handlers can annotate the
trace using trace.FromContext.
2015-09-23 17:07:35 -04:00
Sameer Ajmani 980b4c6d05 grpc: restore changes after sync
Change-Id: I97f0c77f95086301202d0fe4ca477ae6e22dd0b5
2015-09-23 15:18:41 -04:00
iamqizhao 125950284c separate auth info from normal metadata 2015-08-26 11:30:43 -07:00
iamqizhao d12ff72146 allow access of some info of client certificate 2015-08-21 15:49:53 -07:00
Sameer Ajmani 7c57a23f2d grpc: rename "Recv" trace family to "grpc.Recv". 2015-08-09 23:24:53 -04:00
iamqizhao 48f64961c0 fix a bug in the PR#264 2015-07-28 20:04:28 -07:00
yangzhouhan 75cfec3f72 fix a condition bug 2015-07-28 18:26:53 -07:00
yangzhouhan 0231ff14bc remove duplicate check 2015-07-28 18:11:22 -07:00
yangzhouhan 2574b59392 change a comment 2015-07-28 17:33:42 -07:00
yangzhouhan d90cbe84e6 fix trace set error bugs 2015-07-28 17:18:35 -07:00
yangzhouhan 3616d6be54 fix trace setError 2015-07-28 15:27:46 -07:00
yangzhouhan 82323098b5 remove the extra argu 2015-07-28 13:57:37 -07:00
yangzhouhan a3dce46030 making trace as an error when error occurs and fix the format 2015-07-28 10:13:40 -07:00
yangzhouhan a747bc19d9 fix a typo 2015-07-27 14:50:10 -07:00
yangzhouhan 6c8ca3d564 minor change 2015-07-27 14:36:42 -07:00
yangzhouhan 845510e440 add server side tracing 2015-07-27 14:33:17 -07:00
iamqizhao 9738b8b68c add the sanity check back and refactor 2015-06-12 17:31:53 -07:00
iamqizhao 7b318285c9 remove a sanity check to give more flexibility to host a service. It loses some safety though. 2015-06-12 11:23:39 -07:00
iamqizhao a3731d046f only 1 credentials on server 2015-05-12 18:08:36 -07:00
iamqizhao 3617cd5ab3 revert handshaker changes 2015-05-12 17:59:20 -07:00
Peter Edge 7c025e8694 move log package references to grpclog 2015-05-09 11:43:59 +02:00
Peter Edge 101c1e1935 change log package references to grpc/log 2015-05-09 01:16:40 +02:00
iamqizhao c90971aee7 fix a typo 2015-04-30 17:59:40 -07:00
iamqizhao c3da701487 gofmt -w 2015-04-30 16:36:21 -07:00
iamqizhao c6f6e4701d Add a handshaker option to server 2015-04-30 16:30:48 -07:00
iamqizhao 0f85408fd4 Eliminate proto.Unmarshal in the generated code 2015-04-27 14:47:09 -07:00
iamqizhao 571bcddd7c Add cancel_after_begin and cancel_afer_first_response test cases 2015-04-22 15:04:17 -07:00
iamqizhao 3259049490 fix some typos and run gofmt 2015-04-17 13:50:18 -07:00
iamqizhao c7b9fa27dc addressed some comments 2015-04-01 14:22:53 -07:00
iamqizhao bec42c09aa gofmt 2015-04-01 14:05:38 -07:00
iamqizhao 9a5de0e954 make Codec configurable when creating grpc.ClientConn and grpc.Server 2015-04-01 14:02:26 -07:00
iamqizhao 8b08b2d7b2 Interface change to accommodate the support of non-protobuf data formats 2015-03-25 15:18:07 -07:00
iamqizhao 85034d5828 fix double wrapping of rpc status 2015-03-05 18:52:06 -08:00
iamqizhao c42573b827 improve error logging 2015-02-25 16:33:12 -08:00
Matt T. Proud a720ae6f48 Make error conveyance more idiomatic.
This commit applies two bulk changes to the grpc error reporting
mechanisms:

(1.) Error strings for errors that originate within grpc are prefixed
    with the package name for better clarity for where they originate
    since they could percolate up in the users call chains to the
    originator.

(2.) Errors that are, in fact, singletons have been converted from
    fmt.Errorf to errors.New and assigned as package-level variables.
    This bodes particularly well for enabling API customers to elect to
    handle these errors upon receipt via equality comparison.  This had
    been previous impossible with the original API.

Supplementarily, ``gofmt -w -s=true`` has been run on the repository to
cleanup residual defects, and it has detected and repaired a few.

TEST=Manual go test ./...
2015-02-19 13:17:17 +01:00
iamqizhao 634392a1c6 Remove the 2nd RecvProto in the generated code for client streaming 2015-02-18 22:18:01 -08:00
iamqizhao fe60321708 Fix some comments 2015-02-13 16:43:51 -08:00
David Symonds 416f68f4b3 Update import paths to use the new official location of the Go gRPC package. 2015-02-09 11:46:20 +11:00
David Symonds 9e789c396b Rename top level package from "rpc" to "grpc".
Also move the nascent package doc to doc.go.
2015-02-09 11:45:33 +11:00
David Symonds e71095e0ec Move source files up one level.
The top-level directory in this repository is going to be
the main "grpc" package.
2015-02-09 11:33:38 +11:00