Skip to content

Commit 79683be

Browse files
authored
Revert "Add connection preface process to TripleHttp2Protocol (#15368)" (#15435)
This reverts commit e396bde.
1 parent e396bde commit 79683be

File tree

6 files changed

+0
-128
lines changed

6 files changed

+0
-128
lines changed

dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/api/WireProtocol.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,4 @@ public interface WireProtocol {
3232
void configClientPipeline(URL url, ChannelOperator operator, ContextOperator contextOperator);
3333

3434
void close();
35-
36-
default boolean hasConnectionPreface() {
37-
return false;
38-
}
3935
}

dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/api/connection/ConnectionHandler.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,4 @@ public interface ConnectionHandler {
3131
* @param channel Channel
3232
*/
3333
void reconnect(Object channel);
34-
35-
/**
36-
* when connection preface is received.
37-
*
38-
* @param channel Channel
39-
*/
40-
void onConnectionPrefaceReceived(Object channel);
4134
}

dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/AbstractNettyConnectionClient.java

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ public abstract class AbstractNettyConnectionClient extends AbstractConnectionCl
5757

5858
private ConnectionListener connectionListener;
5959

60-
private AtomicReference<Promise<Void>> connectionPrefaceReceivedPromiseRef;
61-
6260
public static final AttributeKey<AbstractConnectionClient> CONNECTION = AttributeKey.valueOf("connection");
6361

6462
public AbstractNettyConnectionClient(URL url, ChannelHandler handler) throws RemotingException {
@@ -83,12 +81,6 @@ protected void initConnectionClient() {
8381
isReconnecting = new AtomicBoolean(false);
8482
connectionListener = new ConnectionListener();
8583
increase();
86-
87-
// Create connection preface received promise for Http2 client since it should wait server http2 settings frame
88-
// before sending client Headers frame, see details at https://github.com/apache/dubbo/issues/15233
89-
if (protocol != null && protocol.hasConnectionPreface()) {
90-
connectionPrefaceReceivedPromiseRef = new AtomicReference<>();
91-
}
9284
}
9385

9486
protected abstract void initBootstrap() throws Exception;
@@ -137,11 +129,6 @@ protected void doConnect() throws RemotingException {
137129
Future<Void> connectPromise = performConnect();
138130
connectPromise.addListener(connectionListener);
139131

140-
Promise<Void> connectionPrefaceReceivedPromise = null;
141-
if (connectionPrefaceReceivedPromiseRef != null) {
142-
connectionPrefaceReceivedPromise = getOrCreateConnectionPrefaceReceivedPromise();
143-
}
144-
145132
boolean ret = connectingPromise.awaitUninterruptibly(getConnectTimeout(), TimeUnit.MILLISECONDS);
146133
// destroy connectingPromise after used
147134
synchronized (this) {
@@ -181,35 +168,6 @@ protected void doConnect() throws RemotingException {
181168

182169
throw remotingException;
183170
}
184-
185-
if (connectionPrefaceReceivedPromise != null) {
186-
long retainedTimeout = getConnectTimeout() - System.currentTimeMillis() + start;
187-
ret = connectionPrefaceReceivedPromise.awaitUninterruptibly(retainedTimeout, TimeUnit.MILLISECONDS);
188-
// destroy connectionPrefaceReceivedPromise after used
189-
synchronized (this) {
190-
connectionPrefaceReceivedPromiseRef.set(null);
191-
}
192-
if (!ret || !connectionPrefaceReceivedPromise.isSuccess()) {
193-
// 6-2 Client-side connection preface timeout
194-
RemotingException remotingException = new RemotingException(
195-
this,
196-
"client(url: " + getUrl() + ") failed to connect to server " + getConnectAddress()
197-
+ " client-side connection preface timeout " + getConnectTimeout() + "ms (elapsed: "
198-
+ (System.currentTimeMillis() - start) + "ms) from netty client "
199-
+ NetUtils.getLocalHost()
200-
+ " using dubbo version "
201-
+ Version.getVersion());
202-
203-
logger.error(
204-
TRANSPORT_CLIENT_CONNECT_TIMEOUT,
205-
"provider crash",
206-
"",
207-
"Client-side connection preface timeout",
208-
remotingException);
209-
210-
throw remotingException;
211-
}
212-
}
213171
}
214172

215173
protected abstract ChannelFuture performConnect();
@@ -288,16 +246,6 @@ public void onGoaway(Object channel) {
288246
}
289247
}
290248

291-
public void onConnectionPrefaceReceived(Object channel) {
292-
if (!(channel instanceof io.netty.channel.Channel) || connectionPrefaceReceivedPromiseRef == null) {
293-
return;
294-
}
295-
Promise<Void> connectionPrefaceReceivedPromise = connectionPrefaceReceivedPromiseRef.get();
296-
if (connectionPrefaceReceivedPromise != null) {
297-
connectionPrefaceReceivedPromise.trySuccess(null);
298-
}
299-
}
300-
301249
@Override
302250
protected Channel getChannel() {
303251
io.netty.channel.Channel c = getNettyChannel();
@@ -354,11 +302,6 @@ private Promise<Object> getOrCreateConnectingPromise() {
354302
return connectingPromiseRef.get();
355303
}
356304

357-
private Promise<Void> getOrCreateConnectionPrefaceReceivedPromise() {
358-
connectionPrefaceReceivedPromiseRef.compareAndSet(null, new DefaultPromise<>(GlobalEventExecutor.INSTANCE));
359-
return connectionPrefaceReceivedPromiseRef.get();
360-
}
361-
362305
public Promise<Void> getClosePromise() {
363306
return closePromise;
364307
}

dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyConnectionHandler.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,6 @@ public void reconnect(Object channel) {
8383
eventLoop.schedule(connectionClient::doReconnect, 1, TimeUnit.SECONDS);
8484
}
8585

86-
@Override
87-
public void onConnectionPrefaceReceived(Object channel) {
88-
if (!(channel instanceof Channel)) {
89-
return;
90-
}
91-
connectionClient.onConnectionPrefaceReceived(channel);
92-
}
93-
9486
@Override
9587
public void channelActive(ChannelHandlerContext ctx) {
9688
ctx.fireChannelActive();

dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TripleHttp2Protocol.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
import org.apache.dubbo.rpc.protocol.tri.h12.http1.DefaultHttp11ServerTransportListenerFactory;
4242
import org.apache.dubbo.rpc.protocol.tri.h12.http2.GenericHttp2ServerTransportListenerFactory;
4343
import org.apache.dubbo.rpc.protocol.tri.transport.TripleGoAwayHandler;
44-
import org.apache.dubbo.rpc.protocol.tri.transport.TripleHttp2SettingsHandler;
4544
import org.apache.dubbo.rpc.protocol.tri.transport.TripleServerConnectionHandler;
4645
import org.apache.dubbo.rpc.protocol.tri.transport.TripleTailHandler;
4746
import org.apache.dubbo.rpc.protocol.tri.websocket.DefaultWebSocketServerTransportListenerFactory;
@@ -96,11 +95,6 @@ public void close() {
9695
super.close();
9796
}
9897

99-
@Override
100-
public boolean hasConnectionPreface() {
101-
return true;
102-
}
103-
10498
@Override
10599
public void configClientPipeline(URL url, ChannelOperator operator, ContextOperator contextOperator) {
106100
TripleConfig tripleConfig = ConfigManager.getProtocolOrDefault(url).getTripleOrDefault();
@@ -122,7 +116,6 @@ public void configClientPipeline(URL url, ChannelOperator operator, ContextOpera
122116
handlers.add(new ChannelHandlerPretender(new Http2MultiplexHandler(new ChannelDuplexHandler())));
123117
handlers.add(new ChannelHandlerPretender(new TriplePingPongHandler(UrlUtils.getCloseTimeout(url))));
124118
handlers.add(new ChannelHandlerPretender(new TripleGoAwayHandler()));
125-
handlers.add(new ChannelHandlerPretender(new TripleHttp2SettingsHandler()));
126119
handlers.add(new ChannelHandlerPretender(new TripleTailHandler()));
127120
operator.configChannelHandler(handlers);
128121
}

dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/transport/TripleHttp2SettingsHandler.java

Lines changed: 0 additions & 45 deletions
This file was deleted.

0 commit comments

Comments
 (0)