Commit Graph

140 Commits

Author SHA1 Message Date
Kun Zhang ff3dbf7b0a Deprecate OkHttpChannelBuilder#overrideHostForAuthority
It is a duplication of overrideAuthority().
2015-09-11 16:22:36 -07:00
Eric Anderson 538cf215f0 Add usePlaintext to ManagedChannelBuilder 2015-09-11 09:57:42 -07:00
Eric Anderson 5b2a03a02e Add overrideAuthority to ManagedChannelBuilder
We want to allow overriding authority in the ManagedChannelBuilder for
testing. In doing that, we basically require that all Channels support
authority. In reality, this simplifies things and is already being done
by the C implementation, as their unix domain socket support uses
"localhost" just like our in-process transport now does.

We can debate some whether "localhost" is really the most appropriate
authority for the in-process transport, but that should probably happen
later since "localhost" is "good enough" for now.
2015-09-11 09:37:49 -07:00
Eric Anderson de32e29592 Add overrideAuthority to OkHttpChannelBuilder 2015-09-11 09:37:48 -07:00
nmittler 0cd28dd32b Fixing okhttp hang when tls nego fails.
Negotiation failure results in a RuntimeException, which is not properly  handled by the okhttp code, resulting in the client hanging.

Refactored the code to shutdown the transport when TLS negotiation fails.
2015-09-10 11:51:14 -07:00
Eric Anderson df7bf44687 Enable license header checking in checkstyle 2015-09-10 11:29:00 -07:00
Eric Anderson 31394aa9df Let transports be channel service providers for generic usage
This provides an API for applications to use gRPC without using
ExperimentalApis. It also allows swapping out a transport implementation
in the future.
2015-09-09 11:06:35 -07:00
Xudong Ma bdaf7b3236 okhttp: Skip trash data for finished stream. 2015-09-03 23:44:43 -07:00
Louis Ryan 6a782a035e Use Executor in stable builder APIs instead of ExecutorService 2015-09-03 14:38:13 -07:00
Carl Mastrangelo 07a7279742 Daemonize OkHttp and Netty 2015-09-03 14:35:04 -07:00
nmittler b687bdc742 Refactoring channel API.
Client:
* New ManagedChannel abstract class.
* Adding ping to Channel.
* Moving builders and implementations to internal.

Server:
* Added lifecycle management API to Server (mirroring ManagedChannel).
* Moved ServerImpl, AbstractServerBuilder and handler registries to internal.
* New ServerBuilder abstract class (mirroring ManagedChannelBuilder).

Fixes #545
2015-09-03 11:22:29 -07:00
Eric Anderson 210114d4a2 Ease use of JWT by passing URI to auth library
The URI no longer needs to be provided to the Credential explicitly,
which prevents needing to know a magic string and allows using the same
Credential with multiple services.
2015-09-01 15:42:58 -07:00
nmittler d3ab427fca Enforce content-type on client and server.
Fixes #360
2015-09-01 06:59:46 -07:00
Xudong Ma a3f2f6249e OkHttp: Fix race condition between sendCancel and sendFrame 2015-08-27 15:11:23 -07:00
nmittler 15f02ba19c Adding maxMessageSize config option
Fixes #832
2015-08-26 15:32:33 -07:00
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
Xudong Ma 485bc9c83c OkHttp: Make sure TransportListener.transportReady() can only be called once. 2015-08-24 13:39:37 -07:00
Carl Mastrangelo a508c1d4f5 Remove Headers 2015-08-24 11:41:10 -07:00
Xudong Ma 21f9b44d14 Use status UNAVAILABLE for IOException thrown by OkHttp reading path, which can also be triggered by HTTP/2 issues. 2015-08-21 16:42:22 -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
Xudong Ma d2ab1c26cb OkHttp: Call ClientTransport.Listener.transportReady() after receiving settings frame. 2015-08-19 16:20:22 -07:00
Eric Anderson 9d1b33cae3 Remove unused variables 2015-08-14 14:53:10 -07:00
Carl Mastrangelo 572f4332a7 Remove Trailers 2015-08-13 17:11:29 -07:00
Xudong Ma ca7587f641 Change some error status usages to be consistent with other gRPC implementations. 2015-08-13 13:14:21 -07:00
Xudong Ma a4c7d9a08a Redo b1e2aaebc0, with some changes to prevent test flaky. 2015-08-12 13:50:26 -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 9eed577d3d Revert "okHttp: Set max_concurrent_stream to 0 before the connection is connected."
This reverts commit b1e2aaebc0.
Broke tests.
2015-08-11 12:42:54 -07:00
Xudong Ma b1e2aaebc0 okHttp: Set max_concurrent_stream to 0 before the connection is connected.
So that the written messages will be queued inside the pending stream instead of the serializingExecutor.
2015-08-11 11:36:26 -07:00
Xudong Ma ddea7435c9 Remove stream id check for writing path, it breaks the starting of pending streams.
And fixes OkHttpClientTransport.mayHaveCreatedStream() for the case that streamId is Integer.MAX_VALUE - 2.
2015-08-11 09:36:42 -07:00
Xudong Ma b42122b035 Update test to demonstrate that pending streams will not be started if the transport is in goAway status. 2015-08-10 17:03:59 -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
Xudong Ma ba103fb871 OkHttp: make the pending stream cancellable. 2015-08-07 11:25:28 -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 67fc45d036 Rename Duplex to Bidi 2015-08-05 17:05:47 -07:00
Xudong Ma 7d1e65c111 Switch ALPN/NPN to advertise only h2 2015-08-05 11:25:05 -07:00
Xudong Ma c55657e3c5 Make new stream call asynchronous when the MAX_CONCURRENT_STREAMS is reached. 2015-08-03 11:38:18 -07:00
Carl Mastrangelo d2b1b37ed7 Add a transport ready for use with retry 2015-07-31 15:24:44 -07:00
Carl Mastrangelo bd8987af1a Add a status to Transport shutdown 2015-07-29 15:35:38 -07:00
Xudong Ma abfdbf69e5 OkHttp: sync error map with gRpc spec. 2015-07-29 08:29:31 -07:00
Xudong Ma dde1e809a7 Adjust @GuardedBy to pass internal GuardedBy Checking.
This is required by our internal sync.
2015-07-28 09:49:18 -07:00
Xudong Ma e36a64e6a6 Correctly handle unknown http2 error code. 2015-07-27 15:49:28 -07:00
Xudong Ma 750f6265e2 Simplify locking model of OkHttp Transport, avoid potential deadlock.
1. Remove the stream lock, use transport lock instead.
2. Protected streams map with the transport lock instead of using synchronized map.
2015-07-27 08:13:19 -07:00
Carl Mastrangelo 2eaeacafe8 Added basic unit test and reorg how onready calls are made
Forgot to add this last file

updated method name

Remove unused function

Remove helper function for threshold edge detection

Remove helper function for threshold edge detection

Re make listener abstract
2015-07-22 14:45:23 -07:00
Xudong Ma 5cc4e84e6e okhttp: Enable TLS by default. 2015-07-21 16:30:57 -07:00
Xudong Ma e8086b5351 Support NPN fallback for Android. 2015-07-21 16:26:15 -07:00
Xudong Ma f9f5b6af0a okhttp: make transport.start() async. 2015-07-21 10:13:02 -07:00
Xudong Ma ad7820ca9b Remove OkHttpClientTransport.DEFAULT_INITIAL_WINDOW_SIZE, use Utils.DEFAULT_WINDOW_SIZE instead. 2015-07-14 17:14:20 -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 8c1d38a0d8 Adding default User-Agent for netty and okhttp. 2015-07-08 15:56:54 -07:00