Commit Graph

170 Commits

Author SHA1 Message Date
nmittler 777e928536 Removing transport shutdown hooks from channel builder
The current process of building a channel is a bit complicated in that transports have to provide a own shutdown hook to the channel builder in order to close shared executors. This somewhat entagled creation pattern makes it difficult to separate the process of channel building from transport building. Better separating these two should make the code more readable and maintainable moving forward.
2015-08-25 08:38:39 -07:00
Carl Mastrangelo 345773504c Quick work around for Rst bug 2015-08-24 11:42:35 -07:00
Carl Mastrangelo a508c1d4f5 Remove Headers 2015-08-24 11:41:10 -07:00
Xudong Ma 13c14df055 Netty: Call ClientTransport.Listener.transportReady() after receiving SETTINGS frame. 2015-08-24 10:57:05 -07:00
nmittler e2f88fa904 Moving a few common utilities to GrpcUtil. 2015-08-24 07:53:32 -07:00
nmittler aeae7a8e74 Rename HttpUtil to GrpcUtil.
It's not really just for HTTP, it has becoming a dumping ground for many internal constants/utilities.
2015-08-21 14:02:26 -07:00
nmittler 9f7cb80108 Adding handling for stream exhaustion in Netty. 2015-08-21 13:01:17 -07:00
Kun Zhang 042b278256 Remove the first MethodDescriptor constructor.
that takes the service name and method name separately.

Also fix tests that are still using the old full qualified method name
format.
2015-08-20 14:19:50 -07:00
Kun Zhang 687a6f4814 Skip io.grpc.internal in javadoc.
Also move ExperimentalApi and Internal to io.grpc, so that they appear
in javadoc.
2015-08-20 08:48:44 -07:00
Xudong Ma bfcebeaa6a Netty: Use status INTERNAL instead of UNKNOWN for underlying Http2Exception. 2015-08-19 12:53:36 -07:00
Carl Mastrangelo 77b00e050b Add Part 1 of compression 2015-08-17 11:32:52 -07:00
Eric Anderson e72332ce5d Add missing Generic param to Answers 2015-08-14 14:53:11 -07:00
Eric Anderson 9d1b33cae3 Remove unused variables 2015-08-14 14:53:10 -07:00
nmittler 247ffb1377 Adding support for NPN fallback.
This takes some steps towards #525, but it won't be fixed until we
officially support OpenSSL. This is due to the fact that ALPN->NPN fallback
isn't supported with Jetty (since only one of the bootstrap plugins can be provided).
2015-08-14 11:21:14 -07:00
Carl Mastrangelo 572f4332a7 Remove Trailers 2015-08-13 17:11:29 -07:00
Kun Zhang e1bd6ef45f Clean up the left-over of the transport package reorganization 2015-08-11 12:48:02 -07:00
Kun Zhang f681b5f8be Move Marshaller into MethodDescriptor 2015-08-11 10:53:38 -07:00
Kun Zhang d2929cd1a3 Reorganize packages.
Reserve io.grpc for public API only, and all internal stuff in core to
io.grpc.internal, including the non-stable transport API.

Raise the netty/okhttp/inprocess subpackages one level up to io.grpc,
because they are public API and entry points for most users.

Details:

- Rename io.grpc.transport to io.grpc.internal;
- Move SharedResourceHolder and SerializingExecutor to io.grpc.internal
- Rename io.grpc.transport.{netty|okhttp|inprocess} to
  io.grpc.{netty|okhttp|inprocess}
2015-08-10 15:04:29 -07:00
Eric Anderson be965b86ab Remove extraneous shutdown condition in NettyClientTransport
We didn't do the extraneous check in notifyTerminated()...
2015-08-10 13:40:45 -07:00
Eric Anderson 6236968d4b netty: Provide useful information if connect fails
Previously you would get an error saying, "Transport failed during
protocol negotiation" and no further information.
2015-08-10 13:24:04 -07:00
Eric Anderson 2addeae2db NettyClientHandler should handle all exceptionCaught()s
If NettyClientHandler doesn't then the exception will propagate to the
end of the pipeline, get logged, and cause any open calls to hang.
2015-08-10 13:24:03 -07:00
Eric Anderson 849ed1b995 netty: Simplify ping cancellation
ChannelInactive should be called in all cases of channel going down, so
we only need to cancel ping there. Use goAwayStatus for the error, since
we will be putting the most effort into making that status useful.
2015-08-10 13:24:00 -07:00
Eric Anderson 017cdd2ae9 netty: Remove connectionError and just use goAwayStatus
When connectionError was set, goAwayStatus was also set, so we shouldn't
lose any errors.

NettyClientTransport doesn't really need a Throwable, it just needs a
Status. Passing a Status out of NettyClientHandler reduces the number of
places that need to do transport-specific translation of Throwables into
Status codes.
2015-08-10 13:23:27 -07:00
Eric Anderson e1c348c24a netty: Don't double-process ssl handshake failures
As described in SslHandler's documentation, handshakeFuture() and
SslHandshakeCompletionEvent are equivalent forms of learning of
handshake completion. Watching both causes double-logging and serves no
purpose.
2015-08-10 12:38:47 -07:00
Eric Anderson 8d38d03c2f netty: If negotiation fails, continue failing new writes
Otherwise new writes will be written to the channel and will fail in
some unhelpful way.

Logging was removed as we really want to propagate the failure back to
the application via Calls, which is done by failing the
CreateStreamCommand message. Propagating back to the application via
call removes uncontrollable log spam and is necessary anyway to inform
the application what sort of failure occurred in order to appropriately
to react.
2015-08-10 12:38:46 -07:00
Jack Coughlin 3eaa92bea6 Send an RST_STREAM frame on server deadline 2015-08-10 09:51:54 -07:00
Kun Zhang fc85a4085a Add more documentation for transports.
- Add package descriptions for transport, netty and okhttp.
- Describe transports (netty, okhttp and inprocess) in README
2015-08-06 17:24:42 -07:00
Carl Mastrangelo aebb58b200 Change awaitTerminated to awaitTermination 2015-08-06 13:52:17 -07:00
Xudong Ma 7d1e65c111 Switch ALPN/NPN to advertise only h2 2015-08-05 11:25:05 -07:00
Eric Anderson 41d875c7e3 Notify transportReady() in Netty 2015-08-03 16:50:05 -07:00
Eric Anderson 248f575a59 Make any lib-generated UNKNOWN have description
Note that even more importantly, this translates a RST_STREAM error code
to a gRPC status code. This is generally useful, but also necessary for
DEADLINE_EXCEEDED to be more reliable in 0eae0d9.

Fixes #687
2015-08-03 11:15:02 -07:00
Carl Mastrangelo bd8987af1a Add a status to Transport shutdown 2015-07-29 15:35:38 -07:00
Eric Anderson 26d77ecd2e Minor readability changes
Improved some consistency. writeHeaders was the only non-final
implementation method of ServerStream, even though it is really no
different than the others.
2015-07-23 10:57:00 -07:00
Carl Mastrangelo 0003e44886 Add simple server timeout support
Reintroduce throws

Add timeoutExecutor shutdown

Use a default future

Move timeout cancellation

Cancel the timeout in error cases
2015-07-15 09:33:16 -07:00
Jack Coughlin 3e26b993ce Enforce request deadline
Use a ScheduledExecutorService in the ChannelImpl to terminate the
request by closing the ClientStream with status DEADLINE_EXCEEDED
2015-07-14 16:47:45 -07:00
Kun Zhang 73acc73dbf Remove Method and switch its users to MethodDescriptor.
Resolves #511.

- In generated code, make CONFIG private and METHOD_* fields public.
  METHOD_* fields are MethodDescriptors now, users of the CONFIG field
  should switch to using the METHOD_* fields.
- Move MethodType into MethodDescriptor (#529).
- Unify the fully qualified method name. It is fully qualified service
  name + slash + short method name. It doesn't have the leading slash.
- HandlerRegistry switches the key from short method name to fully
  qualified method name.
2015-07-09 09:29:03 -07:00
nmittler a6c51e7e14 Fixing some compiler warnings. 2015-07-08 16:10:54 -07:00
nmittler 8c1d38a0d8 Adding default User-Agent for netty and okhttp. 2015-07-08 15:56:54 -07:00
nmittler efbb65522b Simplifying flow control window config for Netty.
Fixes #494
2015-07-08 15:43:03 -07:00
Kun Zhang d3c5b00827 Add CallOptions.
- Pass CallOptions to Channel.newCall() and
  ClientInterceptor.interceptCall().
- Remove timeout from AbstractStub.StubConfigBuilder and add deadline,
  which is stored in a CallOptions inside the stub.
- Deadline is in nanoseconds in the clock defined by System.nanoTime().
  It is converted to timeout before transmitting on the wire. Fail the
  call with DEADLINE_EXCEEDED if it's already expired.
2015-07-07 14:28:38 -07:00
Eric Anderson c7403127ea Revert swapping to the "canonical HTTP mapping"
The mapping is poorly suited for gRPC. C and Go don't even do any
mapping. We can improve the mapping in the future, but it is very
important that users don't start depending on the current mapping.

This change is "inspired by" the original code, but is even more
conservative.

Fixes #477
2015-06-25 12:15:34 -07:00
nmittler ae2b5bfda7 Exposing AbstractBufferingHandler so it can be used by custom protocol negotiators. 2015-06-24 13:59:33 -07:00
Jack Coughlin 77878a04ee Pass timeout header in ChannelImpl 2015-06-17 16:03:13 -07:00
nmittler 4322a43824 Throw error for Netty when Jetty ALPN not configured. 2015-06-17 14:19:55 -07:00
nmittler 9a6ded523a Cleanup of NettyClientTransportTest. 2015-06-16 13:11:03 -07:00
Eric Anderson 424c7e64c3 Avoid GCM in unit tests
GCM is very slow, and doesn't provide any benefit in unit tests. Even if
we were using tcnative and GCM is fast, using more available ciphers in
tests still makes sense. With this change building with Java 7 works
again, although that isn't the reason for the change.

On my machine with parallel building, it cuts full build time from
92 seconds to 39 seconds. For an incremental build after only changing
an interop test, the build time is cut from 73 seconds to 15 seconds.
2015-06-16 12:36:57 -07:00
nmittler cb486e461d Testing that buffered streams clean up properly upon disconnect. 2015-06-15 13:10:21 -07:00
nmittler 491aad2659 Changing Netty handlers to properly set initialSettings. 2015-06-11 15:06:20 -07:00
Josh Humphries 0d03f89467 add ping 2015-06-10 12:20:08 -04:00
nmittler 4ee2a6584a Allowing Netty TLS bootstrap handler to be sharable.
Fixes #504
2015-06-03 09:42:08 -07:00