Commit Graph

209 Commits

Author SHA1 Message Date
Louis Ryan 986d221eaa Fix issue where close can be called in a reentrant fashion by framer writing causing exception to be thrown by transport 2015-04-28 12:46:48 -07:00
Louis Ryan f679edcfcc Fix memeory leak in MessageFramer caused by allocation of 'empty' buffers never being released.
The buffers are not empty in reality as the allocators enforce a minimum size
2015-04-28 10:10:00 -07:00
Xudong Ma d0aad72441 okhttp: Clean up stream when error happens.
Resolves #279
2015-04-27 14:07:43 -07:00
Xudong Ma 2f4aa5a490 Use Status "UNKNOWN" instead of "INTERNAL" when Status.fromThrowable can not find a cause with a status. 2015-04-24 10:52:27 +08:00
Louis Ryan f7010f2eac Use message size as a hint to the allocator for buffer capacity.
Set upper and lower bounds for Netty & OkHttp allocators based on transport limitations and benchmark results.
Fix OkHttp OutboundFlowController to chunk payloads larger than frameWriter.maxDataLength
Allow OkHttp to allocate buffers to FrameWriter larger than max DATA length
2015-04-23 16:58:43 -07:00
Eric Anderson fc3e41674b Propagate explicit flushes through MessageFramer
MessageFramer allows queing of data and explicit flushing. Sinks
generally can benefit from knowing when they are required to flush, so
we now tell them when MessageFramer received a flush so they only have
to flush when required.
2015-04-21 10:29:08 -07:00
Eric Anderson 4f4f8e40bf Remove Guava's Service from server transport
ServerImpl.start() now throws IOException to make the error explicit.
This was previously being papered over by wrapping the exception in
RuntimeException.
2015-04-16 11:28:04 -07:00
nmittler f920badc5e Upgrading to the latest Netty version. 2015-04-16 08:42:56 -07:00
Eric Anderson e23f899491 Split protobuf into its own project
We don't want core to depend on protobuf.
2015-04-10 15:50:56 -07:00
Eric Anderson d077290c40 Fix warnings (JavaDoc and [deprecated]) 2015-04-09 18:05:31 -07:00
Kun Zhang 0d89d3d1bc Fix the issue where the intecepting call fails in start(), does not
call super.start(), and makes the subsequent use of other methods on the
call throw IllegalStateException.

Create ClientInterceptors.CheckedForwardingCall that handles exception
in start logic.

Create Forwarding[Server]Call[Listener] for generic decoration use
cases, with an abstract delegate() for flexibility.

Create SimpleForwarding[Server]Call[Listener] to replace now deprecated
forwarding classes.
2015-04-09 15:56:03 -07:00
Xudong Ma 9aae6f65fa checkstyle change:
1. Adds <property name="separateLineBetweenGroups" value="true"/> to CustomImportOrder to enfore blank line between imports groups.
2. Uses checkstyle 6.5, which fixed a bug of "CustomImportOrder checks import sorting according to ASCII order instead of case-insensitive alphabetical order".
2015-04-07 08:27:48 +08:00
Eric Anderson 45682dbc18 Hold lock while reading isThreadScheduled
isThreadScheduled is @GuardedBy("internalLock").
2015-04-06 14:13:49 -07:00
Eric Anderson d70d91b5d6 Improve JavaDoc for Status 2015-04-03 16:07:46 -07:00
Xudong Ma 2cad9e6000 Add "unsed import" check. 2015-04-03 16:55:01 +08:00
zhangkun83 966e120098 Add precondition to throw more informative exception when calling request() before start() has been called. 2015-03-26 10:54:59 -07:00
Thomas ten Cate 9175d9d79e Fix data corruption issue receiving payloads > 2kB
Also add OkHttpReadableBuffer unit test, and increase the test string
length to expose the bug.

Also use array equality assertions in the base test, instead of
comparisons whose return value is discarded.

Fixes #231.
2015-03-22 13:14:57 +01:00
Eric Anderson a6edc294fc Improve Status exception message
When the description is null, the exception message would be in the form
of "INTERNAL: null", which isn't very attractive, and makes it seem like
an error in itself. If the description is null, just use "INTERNAL".
2015-03-20 10:29:11 -07:00
Eric Anderson 78cde0ddc0 Move Status.toString next to other methods 2015-03-20 09:47:34 -07:00
nmittler 23972a25b9 Adding outbound flow control API for the transport API 2015-03-16 14:17:03 -07:00
nmittler 9f5614501d Adding outbound flow control API for Call/ServerCall 2015-03-16 12:59:15 -07:00
Eric Anderson 040007ec17 Add package statement to HttpUtilTest 2015-03-16 12:38:07 -07:00
Eric Anderson c3e8dae6ce Add checkstyle checking
The checkstyle.xml is a slightly modified version of the upstream Google
checkstyle configuration. All changes have comment describing them.

Lots of warnings were corrected. Examples is the only project that has
warnings still, as the necessary changes require some thought.
2015-03-16 10:53:13 -07:00
Jakob Buchgraber 0076243063 Add WritableBuffer interface for zero copy data writes. Fixes #8
WritableBuffer is a generic interface that allows to transfer data
from gRPC directly to the native transport's buffer implementation.
2015-03-13 13:00:44 -07:00
Eric Anderson 76d0955a6e Clean up warnings
-Xlint:-options is not available on some earlier JDK 7s, but won't fail
if unsupported. It prevents the warning wanting bootclasspath specified
since target/source is 1.6.
2015-03-12 17:37:32 -07:00
Eric Anderson acfe3def6e Stall MessageDeframer pro-actively
This allows sooner delivery of errors. We never needed to stop delivery
for unexpected EOS, but instead the application would have been required
to request() another message before delivering. Stalling MessageDeframer
sooner removes the need for the application to request another message
before noticing that the buffers are empty.
2015-03-12 11:28:19 -07:00
Eric Anderson 238a4cb620 Add two extra cases to make edge case testing more obvious. 2015-03-11 15:14:28 -07:00
Eric Anderson 8986fc3412 Reorganize tests. Tweak Javadoc formatting 2015-03-11 15:10:35 -07:00
Eric Anderson 0e904f08e0 Tweak Http2Error and add tests 2015-03-11 14:45:03 -07:00
nmittler 2a425090d1 Migrating to Netty 4.1
Fixes #164
2015-03-11 13:18:27 -07:00
Jorge Canizales ad5ae259bb Fixes javadoc errors 2015-03-10 09:24:06 -07:00
Nathan Mittler f1b6f623c5 Merge pull request #166 from nmittler/doclint
Tightening up error message for GO_AWAY.
2015-03-09 13:49:03 -07:00
nmittler dfcfb7bca1 Tightening up error message for GO_AWAY.
The attempt here is to identify all causes of GO_AWAY and to ensure
there is a reasonable description to help understand the cause.

Fixes #163
2015-03-09 13:48:15 -07:00
nmittler 4deff027ba Proper buffer closure when receiving DATA with EOS
The Http2ClientStream should not close the buffer in this case since
it's already been given to the deframer and potentially to the user.

Added cleanup code to MessageDeframer and AbstractClientStream to make
sure that we free the Buffer when appropriate.
2015-03-09 13:28:32 -07:00
nmittler 732cfc0d55 Disable Javadoc doclint on Java 8
It breaks the build.
2015-03-03 07:59:13 -08:00
zhangkun83 ef87818758 Polish javadoc for transport/ 2015-03-02 11:10:29 -08:00
Louis Ryan 46dd47f86b Cleanup Javadoc for Channel, ServerCall and their related classes. 2015-02-25 14:22:12 -08:00
Louis Ryan 425e3c0b7f Remove dead GrpcFramingUtil class 2015-02-23 17:44:23 -08:00
Louis Ryan 95c6f5082c Udate TODOs to use Github user names 2015-02-23 12:46:28 -08:00
Eric Anderson ee6c9d7b52 Add scary JavaDoc to Metadata.setAuthority() 2015-02-20 08:54:08 -08:00
Eric Anderson dbf7d529bd Make sure to close InputStream even if cancelled 2015-02-20 08:52:51 -08:00
Jakob Buchgraber 07d0917b94 Add ServerImpl#awaitTerminated() method. Fixes #80 2015-02-18 16:00:34 -08:00
Eric Anderson e26608fe91 Avoid MoreObjects for "old guava" compatibility
Some early grpc users on Android are using a very old Guava. They are
working on upgrading, but it will take time. This alone is not enough
for "old guava" compilibility; expect more to come.
2015-02-13 17:06:46 -08:00
Eric Anderson 74f231a6dd Remove Guava Service from ClientTransport
OkHttp no longer cancels all calls on shutdown, as we want to allow
graceful shutdown. Such cancelling behavior will likely be provided by
Channel in the future.
2015-02-12 15:20:22 -08:00
Eric Anderson db0d8ad8c4 Only run terminationRunnable once 2015-02-12 15:17:12 -08:00
nabeelmian d2e35b0d02 Added utility class, ForwardingServerListener, that forwards calls to
underlying ServerCall.Listener.

-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=85910420
2015-02-09 13:09:19 -08:00
Eric Anderson 8aa79b39fc Improve thread safety of newStream()
OkHttp should now have a thread-safe implementation of newStream.
Previously 'lock' was not held when checking goAway and the checking in
AbstractClientTransport was redundant.

Netty was thread-safe, but it was very hard to tell what guarantees were
necessary and what guarantees each piece was providing.
2015-02-06 14:12:01 -08:00
Eric Anderson f3a90cd42b netty: Cancel stream if interrupted during create
Previously streams were being partially orphaned if there was an
interruption during stream creation. To handle cancellation,
AbstractClientStream's cancel() had to be changed remove the
"optimization" otherwise, again, the stream would be orphaned.
2015-02-04 15:46:27 -08:00
nmittler d0e883ac20 Fixing integration tests
Allowing MessageDeframer.request to be called after the deframer has
been closed.  The stub helpers blindly call request after receiving each
message.
2015-01-30 10:15:30 -08:00
nmittler 89b8d7ff47 Moving decompression to the channel thread. 2015-01-29 14:55:40 -08:00