Add flag to indicate that a data message used with a close flag
is not sending any data. This clears up any ambiguity over whether the
final data message is transmitting a zero length data message or no
data at all.
Signed-off-by: Derek McGowan <derek@mcg.dev>
Implementation of the 1.2 protocol with support for streaming. Provides
the client and server interfaces for implementing services with
streaming.
Unary behavior is mostly unchanged and avoids extra stream tracking just
for unary calls. Streaming calls are tracked to route data to the
appropriate stream as it is received.
Stricter stream ID handling, disallowing unexpected re-use of stream
IDs.
Signed-off-by: Derek McGowan <derek@mcg.dev>
We have lost Codecov since #101. While the main containerd repository
doesn't have that, ttrpc could have Codecov without much complications.
Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
Git by default uses CR+LF on Windows, whereas gofmt always
uses LF even on Windows.
This commit lets Git uses LF on Windows.
Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
This test occasionally fails on Windows. This commit logs extra
information about the error to understand the situation better.
Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
This change replaces github.com/gogo/protobuf with
google.golang.org/protobuf, except for the code generators.
All proto-encoded structs are now generated from .proto files,
which include ttrpc.Request and ttrpc.Response.
Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
Google's new protobuf code generator only supports protobuf
serialization/deserialization and let other code generators handle
RPC-related aspects.
This new code generator follows the change and can be used with
the new protobuf code generator.
Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
Changes the TTRPC client logic so that sending and receiving with the
server are in completely independent goroutines, with shared state
guarded by a mutex. Previously, sending/receiving were tied together by
reliance on a coordinator goroutine. This led to issues where if the
server was not reading from the connection, the client could get stuck
sending a request, causing the client to not read responses from the
server. See [1] for more details.
The new design sets up separate sending/receiving goroutines. These
share state in the form of the set of active calls that have been made
to the server. This state is encapsulated in the callMap type and access
is guarded by a mutex.
The main event loop in `run` previously handled a lot of state
management for the client. Now that most state is tracked by the
callMap, it mostly exists to notice when the client is closed and take
appropriate action to clean up.
Also did some minor code cleanup. For instance, the code was previously
written to support multiple receiver goroutines, though this was not
actually used. I've removed this for now, since the code is simpler this
way, and it's easy to add back if we actually need it in the future.
[1] https://github.com/containerd/ttrpc/issues/72
Signed-off-by: Kevin Parsons <kevpar@microsoft.com>
gRPC has UNIMPLEMENTED status code that indicates a requested method
is not implemented. However ttrpc was returning codes.NotFound which
could be returned when a request entity was not there.
This fix changes the status code from codes.NotFound to
codes.Unimplemented to disambiguate and be more compatible with gRPC.
Fixes#80.
Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>