Please sign in to comment.
Ensure `TcpConnector#connect` does not emit error after success (#967)
__Motivation__ `TcpConnector#connect` eagerly terminates the `Single` when the channel is registered. It also terminates the `Single` with failure if connect fails. This violates the contract of the `Subscriber` that there should only be a single termination signal. __Modification__ As we have to complete the returned `Single` with the channel as soon as the channel is registered to ensure we do not miss channel events and we also have to propagate connect failures, we can not abide by the `Single<Channel>` contract. Instead of returning `Single<Channel>` now returning `Single<Connection>` and do the translation of `Channel` -> `Connection` using a supplied `Function`. __Result__ `TcpConnector#connect` abides by the `Subscriber` contract.
- Loading branch information
Showing with 199 additions and 102 deletions.
- +2 −2 servicetalk-http-netty/src/main/java/io/servicetalk/http/netty/AlpnLBHttpConnectionFactory.java
- +2 −2 servicetalk-http-netty/src/main/java/io/servicetalk/http/netty/H2LBHttpConnectionFactory.java
- +2 −2 servicetalk-http-netty/src/main/java/io/servicetalk/http/netty/StreamingConnectionFactory.java
- +27 −22 servicetalk-http-netty/src/test/java/io/servicetalk/http/netty/HttpRequestEncoderTest.java
- +147 −66 servicetalk-tcp-netty-internal/src/main/java/io/servicetalk/tcp/netty/internal/TcpConnector.java
- +4 −5 servicetalk-tcp-netty-internal/src/test/java/io/servicetalk/tcp/netty/internal/TcpConnectorTest.java
- +15 −3 ...icetalk-tcp-netty-internal/src/testFixtures/java/io/servicetalk/tcp/netty/internal/TcpClient.java
Oops, something went wrong.