Commit Graph

125 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
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
nmittler efbb65522b Simplifying flow control window config for Netty.
Fixes #494
2015-07-08 15:43:03 -07:00
Eric Anderson 30455fd2f4 Remove unused variables 2015-07-06 16:27:22 -07:00
Eric Anderson cb15779e59 Use class name, not instance, for invoking static method 2015-07-06 16:27:21 -07:00
Eric Anderson 10578e31c0 param in JavaDoc is lower-case 2015-07-06 16:27:21 -07:00
Xiao Hang 3777b8bf65 Use hostname instead of InetAddress for Socket creation.
On Android platform, the constructor using hostname will iterate through all solved ip address for making connection.
Before we implement happy eyeballs, this could be a workaround for Android users.
2015-06-29 19:12:15 -07:00
Eric Anderson 45da9c5766 Add a few ChannelImpl tests and improve error status 2015-06-26 12:19:41 -07:00
Xudong Ma 6e406ac4a5 Refactor OkHttpProtocolNegotiator, move Android related operations into an inner class. 2015-06-26 09:59:22 -07:00
Xudong Ma eb15eb2821 Some cleanup for okhttp:
1. Move DEFAULT_CONNECTION_SPEC to OkHttpChannelBuilder
2. make OkHttpClientTransport package-private
3. Rename OkHttpChannelBuilder.setConnectionSpec to connectionSpec
2015-06-18 13:29:18 -07:00
Xudong Ma 25da64937d Support setting ALPN for Android older than 5.0, OkHttp(2.3+) implementation only support such function for Android 5.0+.
Manually tested with the test App: https://github.com/madongfly/grpc-android-test.

Fixes #520
2015-06-11 14:39:26 -07:00
Josh Humphries 0d03f89467 add ping 2015-06-10 12:20:08 -04:00
Xudong Ma d242b225d0 Upgrade OkHttp to 2.4.
Fixes #490
2015-06-01 14:53:19 -07:00
Xudong Ma eed8f923af okhttp: Call onError for IOException thrown by FrameReader.nextFrame().
Since OkHttp wraps many protocol error as IOException, we need to send GoAway for such errors.

Fixes #487
2015-05-29 10:21:52 -07:00
Xudong Ma 0782c0408d Catch Exception thrown when query NPN selected protocol on a socket that haven't started hand shake. 2015-05-29 08:59:05 -07:00
Xudong Ma 2fe279f7c2 Add SelectedProtocolQuerier to get protocol selected by NPN on Android.
Fixes #467

Manually tested by using NPN on Android 4.3 (api level 18) talk to GFE.
2015-05-27 17:16:44 -07:00
Louis Ryan 641fc288fc Add support for indeterminate length messages. This will make using GRPC easier for non-proto payload types.
Sync to head
2015-05-26 15:44:46 -07:00