GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Make half-closure a core-concept of Channel (#12468) · netty/netty@1a37114

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • codec-base/src
    • main/java/io/netty/handler/codec
      • ByteToMessageDecoder.java
    • test/java/io/netty/handler/codec
      • ByteToMessageDecoderTest.java
      • ReplayingDecoderTest.java
  • codec-classes-quic/src/main/java/io/netty/handler/codec/quic
    • QuicStreamChannel.java
    • QuicheQuicChannel.java
    • QuicheQuicStreamChannel.java
  • codec-http2/src
    • main/java/io/netty/handler/codec/http2
      • AbstractHttp2StreamChannel.java
      • Http2ConnectionHandler.java
      • Http2MultiplexCodec.java
      • Http2MultiplexHandler.java
    • test/java/io/netty/handler/codec/http2
      • Http2FrameInboundWriter.java
      • Http2MultiplexTest.java
  • codec-http3/src
    • main/java/io/netty/handler/codec/http3
      • Http3CodecUtils.java
      • Http3ControlStreamInboundHandler.java
      • Http3ControlStreamOutboundHandler.java
      • Http3FrameCodec.java
      • Http3FrameToHttpObjectCodec.java
      • Http3FrameTypeDuplexValidationHandler.java
      • Http3PushStreamClientValidationHandler.java
      • Http3RequestStreamInboundHandler.java
      • Http3RequestStreamValidationHandler.java
      • Http3ServerPushStreamManager.java
      • QpackDecoderHandler.java
      • QpackEncoderHandler.java
    • test/java/io/netty/handler/codec/http3
      • EmbeddedQuicStreamChannel.java
      • Http3FrameToHttpObjectCodecTest.java
      • Http3RequestStreamInboundHandlerTest.java
      • Http3RequestStreamValidationHandlerTest.java
  • codec-http/src
    • main/java/io/netty/handler/codec
      • http
        • HttpClientUpgradeHandler.java
        • websocketx
          • WebSocketProtocolHandler.java
      • spdy
        • SpdyFrameCodec.java
    • test/java/io/netty/handler/codec/http
      • HttpClientCodecTest.java
  • codec-native-quic/src/test/java/io/netty/handler/codec/quic
    • QuicChannelConnectTest.java
    • QuicStreamChannelCloseTest.java
    • QuicStreamFrameTest.java
    • QuicStreamHalfClosureTest.java
    • QuicStreamLimitTest.java
    • QuicStreamShutdownTest.java
    • example
      • QuicClientExample.java
      • QuicClientZeroRTTExample.java
  • handler-proxy/src/main/java/io/netty/handler/proxy
    • HttpProxyHandler.java
  • handler/src
    • main/java/io/netty/handler/ssl
      • ApplicationProtocolNegotiationHandler.java
      • SslClientHelloHandler.java
      • SslHandler.java
    • test/java/io/netty/handler/ssl
      • ApplicationProtocolNegotiationHandlerTest.java
  • microbench/src/main/java/io/netty/microbench/channel
    • EmbeddedChannelHandlerContext.java
  • testsuite/src/main/java/io/netty/testsuite/transport/socket
    • AbstractSocketShutdownOutputByPeerTest.java
    • SocketChannelNotYetConnectedTest.java
    • SocketHalfClosedTest.java
    • SocketShutdownOutputBySelfTest.java
  • transport-classes-epoll/src/main/java/io/netty/channel/epoll
    • AbstractEpollChannel.java
    • EpollDatagramChannel.java
    • EpollServerSocketChannel.java
    • EpollSocketChannel.java
  • transport-classes-io_uring/src/main/java/io/netty/channel/uring
    • AbstractIoUringChannel.java
    • IoUringDatagramChannel.java
    • IoUringServerSocketChannel.java
    • IoUringSocketChannel.java
  • transport-classes-kqueue/src/main/java/io/netty/channel/kqueue
    • AbstractKQueueChannel.java
    • AbstractKQueueStreamChannel.java
    • KQueueDatagramChannel.java
    • KQueueServerSocketChannel.java
    • KQueueSocketChannel.java
  • transport-sctp/src/main/java/io/netty/channel/sctp/nio
    • NioSctpChannel.java
    • NioSctpServerChannel.java
  • transport/src
    • main/java/io/netty
      • bootstrap
        • FailedChannel.java
      • channel
        • AbstractChannel.java
        • AbstractChannelHandlerContext.java
        • AbstractServerChannel.java
        • Channel.java
        • ChannelDuplexHandler.java
        • ChannelHandlerContext.java
        • ChannelHandlerMask.java
        • ChannelInboundHandler.java
        • ChannelInboundHandlerAdapter.java
        • ChannelInboundInvoker.java
        • ChannelOutboundBuffer.java
        • ChannelOutboundHandler.java
        • ChannelOutboundHandlerAdapter.java
        • ChannelOutboundInvoker.java
        • ChannelOutputShutdownException.java
        • ChannelPipeline.java
        • ChannelShutdownDirection.java
        • ChannelShutdownType.java
        • CombinedChannelDuplexHandler.java
        • DefaultChannelPipeline.java
        • IoTransport.java
        • embedded
          • EmbeddedChannel.java
        • local
          • LocalChannel.java
        • nio
          • AbstractNioByteChannel.java
        • socket
          • ChannelInputShutdownEvent.java
          • ChannelInputShutdownReadComplete.java
          • ChannelOutputShutdownEvent.java
          • DuplexChannel.java
          • SocketChannel.java
          • nio
            • NioDatagramChannel.java
            • NioServerSocketChannel.java
            • NioSocketChannel.java
    • test/java/io/netty
      • bootstrap
        • TestChannel.java
      • channel
        • AbstractChannelTest.java
        • ChannelOutboundBufferTest.java
        • DefaultChannelPipelineTailTest.java
        • DefaultChannelPipelineTest.java
        • LoggingHandler.java
        • socket/nio
          • NioSocketChannelTest.java

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎codec-base/src/main/java/io/netty/handler/codec/ByteToMessageDecoder.java‎

Copy file name to clipboardExpand all lines: codec-base/src/main/java/io/netty/handler/codec/ByteToMessageDecoder.java
+8-5Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
import io.netty.channel.ChannelConfig;
2323
import io.netty.channel.ChannelHandlerContext;
2424
import io.netty.channel.ChannelInboundHandlerAdapter;
25-
import io.netty.channel.socket.ChannelInputShutdownEvent;
25+
import io.netty.channel.ChannelShutdownDirection;
26+
import io.netty.channel.ChannelShutdownType;
2627
import io.netty.util.IllegalReferenceCountException;
2728
import io.netty.util.internal.ObjectUtil;
2829
import io.netty.util.internal.StringUtil;
@@ -393,14 +394,16 @@ public void channelInactive(ChannelHandlerContext ctx) throws Exception {
393394
}
394395

395396
@Override
396-
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
397-
if (evt instanceof ChannelInputShutdownEvent) {
397+
public void channelShutdown(ChannelHandlerContext ctx, ChannelShutdownType type)
398+
throws Exception {
399+
if (type.direction() == ChannelShutdownDirection.Inbound) {
398400
// The decodeLast method is invoked when a channelInactive event is encountered.
399401
// This method is responsible for ending requests in some situations and must be called
400402
// when the input has been shutdown.
401403
channelInputClosed(ctx, false);
402404
}
403-
super.userEventTriggered(ctx, evt);
405+
406+
super.channelShutdown(ctx, type);
404407
}
405408

406409
private void channelInputClosed(ChannelHandlerContext ctx, boolean callChannelInactive) {
@@ -435,7 +438,7 @@ private void channelInputClosed(ChannelHandlerContext ctx, boolean callChannelIn
435438

436439
/**
437440
* Called when the input of the channel was closed which may be because it changed to inactive or because of
438-
* {@link ChannelInputShutdownEvent}.
441+
* {@link #channelShutdown(ChannelHandlerContext, ChannelShutdownType}.
439442
*/
440443
void channelInputClosed(ChannelHandlerContext ctx, List<Object> out) throws Exception {
441444
if (cumulation != null) {
Collapse file

‎codec-base/src/test/java/io/netty/handler/codec/ByteToMessageDecoderTest.java‎

Copy file name to clipboardExpand all lines: codec-base/src/test/java/io/netty/handler/codec/ByteToMessageDecoderTest.java
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525
import io.netty.channel.ChannelHandlerContext;
2626
import io.netty.channel.ChannelInboundHandlerAdapter;
2727
import io.netty.channel.ChannelOutboundHandlerAdapter;
28+
import io.netty.channel.ChannelShutdownType;
2829
import io.netty.channel.SimpleChannelInboundHandler;
2930
import io.netty.channel.embedded.EmbeddedChannel;
30-
import io.netty.channel.socket.ChannelInputShutdownEvent;
3131
import io.netty.util.CharsetUtil;
3232
import org.junit.jupiter.api.Test;
3333

@@ -567,7 +567,7 @@ protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) {
567567
assertNull(channel.readInbound());
568568
removeHandler.set(true);
569569
// This should trigger channelInputClosed(...)
570-
channel.pipeline().fireUserEventTriggered(ChannelInputShutdownEvent.INSTANCE);
570+
channel.pipeline().fireChannelShutdown(ChannelShutdownType.newInbound());
571571

572572
assertTrue(channel.finish());
573573
assertBuffer(Unpooled.wrappedBuffer(bytes), (ByteBuf) channel.readInbound());
Collapse file

‎codec-base/src/test/java/io/netty/handler/codec/ReplayingDecoderTest.java‎

Copy file name to clipboardExpand all lines: codec-base/src/test/java/io/netty/handler/codec/ReplayingDecoderTest.java
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
import io.netty.buffer.Unpooled;
2020
import io.netty.channel.ChannelHandlerContext;
2121
import io.netty.channel.ChannelInboundHandlerAdapter;
22+
import io.netty.channel.ChannelShutdownType;
2223
import io.netty.channel.embedded.EmbeddedChannel;
23-
import io.netty.channel.socket.ChannelInputShutdownEvent;
2424
import org.junit.jupiter.api.Test;
2525

2626
import java.util.List;
@@ -282,7 +282,7 @@ protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) t
282282
});
283283

284284
assertFalse(channel.writeInbound(Unpooled.wrappedBuffer(new byte[] {0, 1})));
285-
channel.pipeline().fireUserEventTriggered(ChannelInputShutdownEvent.INSTANCE);
285+
channel.pipeline().fireChannelShutdown(ChannelShutdownType.newInbound());
286286
assertFalse(channel.finishAndReleaseAll());
287287

288288
Error err = error.get();
Collapse file

‎codec-classes-quic/src/main/java/io/netty/handler/codec/quic/QuicStreamChannel.java‎

Copy file name to clipboardExpand all lines: codec-classes-quic/src/main/java/io/netty/handler/codec/quic/QuicStreamChannel.java
+7-95Lines changed: 7 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,21 @@
1515
*/
1616
package io.netty.handler.codec.quic;
1717

18+
import io.netty.channel.Channel;
1819
import io.netty.channel.ChannelFuture;
1920
import io.netty.channel.ChannelFutureListener;
2021
import io.netty.channel.ChannelPromise;
21-
import io.netty.channel.socket.DuplexChannel;
22-
import io.netty.channel.socket.SocketChannel;
22+
import io.netty.channel.ChannelShutdownType;
2323
import org.jetbrains.annotations.Nullable;
2424

2525
import java.net.SocketAddress;
2626

2727
/**
28-
* A QUIC stream {@link DuplexChannel}.
28+
* A QUIC stream {@link Channel}.
2929
*
3030
* <h3>Available options</h3>
3131
*
32-
* In addition to the options supported by {@link DuplexChannel},
32+
* In addition to the options supported by {@link Channel},
3333
* {@link QuicStreamChannel} allows the following options in the
3434
* option map via {@link io.netty.channel.ChannelOption}:
3535
*
@@ -41,13 +41,14 @@
4141
* </tr>
4242
* </table>
4343
*/
44-
public interface QuicStreamChannel extends DuplexChannel {
44+
public interface QuicStreamChannel extends Channel {
4545

4646
/**
4747
* Should be added to a {@link ChannelFuture} when the output should be cleanly shutdown via a {@code FIN}. No more
4848
* writes will be allowed after this point.
4949
*/
50-
ChannelFutureListener SHUTDOWN_OUTPUT = f -> ((QuicStreamChannel) f.channel()).shutdownOutput();
50+
ChannelFutureListener SHUTDOWN_OUTPUT = f ->
51+
f.channel().shutdown(ChannelShutdownType.newOutbound());
5152

5253
@Override
5354
default ChannelFuture bind(SocketAddress socketAddress) {
@@ -145,95 +146,6 @@ default ChannelFuture newFailedFuture(Throwable cause) {
145146
return pipeline().newFailedFuture(cause);
146147
}
147148

148-
@Override
149-
default ChannelFuture shutdownInput() {
150-
return shutdownInput(newPromise());
151-
}
152-
153-
@Override
154-
default ChannelFuture shutdownInput(ChannelPromise promise) {
155-
return shutdownInput(0, promise);
156-
}
157-
158-
@Override
159-
default ChannelFuture shutdownOutput() {
160-
return shutdownOutput(newPromise());
161-
}
162-
163-
@Override
164-
default ChannelFuture shutdown() {
165-
return shutdown(newPromise());
166-
}
167-
168-
/**
169-
* Shortcut for calling {@link #shutdownInput(int)} and {@link #shutdownInput(int)}.
170-
*
171-
* @param error the error to send.
172-
* @return the future that is notified on completion.
173-
*/
174-
default ChannelFuture shutdown(int error) {
175-
return shutdown(error, newPromise());
176-
}
177-
178-
/**
179-
* Shortcut for calling {@link #shutdownInput(int, ChannelPromise)} and {@link #shutdownInput(int, ChannelPromise)}.
180-
*
181-
* @param error the error to send.
182-
* @param promise will be notified on completion.
183-
* @return the future that is notified on completion.
184-
*/
185-
ChannelFuture shutdown(int error, ChannelPromise promise);
186-
187-
/**
188-
* Shutdown the input of the stream with the given error code. This means a {@code STOP_SENDING} frame will
189-
* be send to the remote peer and all data received will be discarded.
190-
*
191-
* @param error the error to send as part of the {@code STOP_SENDING} frame.
192-
* @return the future that is notified on completion.
193-
*/
194-
default ChannelFuture shutdownInput(int error) {
195-
return shutdownInput(error, newPromise());
196-
}
197-
198-
/**
199-
* Shutdown the input of the stream with the given error code. This means a {@code STOP_SENDING} frame will
200-
* be send to the remote peer and all data received will be discarded.
201-
*
202-
* @param error the error to send as part of the {@code STOP_SENDING} frame.
203-
* @param promise will be notified on completion.
204-
* @return the future that is notified on completion.
205-
*/
206-
ChannelFuture shutdownInput(int error, ChannelPromise promise);
207-
208-
/**
209-
* Shutdown the output of the stream with the given error code. This means a {@code RESET_STREAM} frame will
210-
* be send to the remote peer and all data that is not sent yet will be discarded.
211-
*
212-
* <strong>Important:</strong>If you want to shutdown the output without sending a {@code RESET_STREAM} frame you
213-
* should use {@link #shutdownOutput()} which will shutdown the output by sending a {@code FIN} and so signal
214-
* a clean shutdown.
215-
*
216-
* @param error the error to send as part of the {@code RESET_STREAM} frame.
217-
* @return the future that is notified on completion.
218-
*/
219-
default ChannelFuture shutdownOutput(int error) {
220-
return shutdownOutput(error, newPromise());
221-
}
222-
223-
/**
224-
* Shutdown the output of the stream with the given error code. This means a {@code RESET_STREAM} frame will
225-
* be send to the remote peer and all data that is not sent yet will be discarded.
226-
*
227-
* <strong>Important:</strong>If you want to shutdown the output without sending a {@code RESET_STREAM} frame you
228-
* should use {@link #shutdownOutput(ChannelPromise)} which will shutdown the output by sending a {@code FIN}
229-
* and so signal a clean shutdown.
230-
*
231-
* @param error the error to send as part of the {@code RESET_STREAM} frame.
232-
* @param promise will be notified on completion.
233-
* @return the future that is notified on completion.
234-
*/
235-
ChannelFuture shutdownOutput(int error, ChannelPromise promise);
236-
237149
@Override
238150
QuicStreamAddress localAddress();
239151

Collapse file

‎codec-classes-quic/src/main/java/io/netty/handler/codec/quic/QuicheQuicChannel.java‎

Copy file name to clipboardExpand all lines: codec-classes-quic/src/main/java/io/netty/handler/codec/quic/QuicheQuicChannel.java
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import io.netty.channel.ChannelOutboundBuffer;
3030
import io.netty.channel.ChannelPipeline;
3131
import io.netty.channel.ChannelPromise;
32+
import io.netty.channel.ChannelShutdownType;
3233
import io.netty.channel.RecvByteBufAllocator;
3334
import io.netty.channel.socket.DatagramPacket;
3435
import io.netty.handler.ssl.SniCompletionEvent;
@@ -242,6 +243,11 @@ private static long[] growIfNeeded(long[] array, int maxLength) {
242243
return array;
243244
}
244245

246+
@Override
247+
protected void doShutdown(ChannelShutdownType type, ChannelPromise promise) {
248+
promise.setFailure(new UnsupportedOperationException());
249+
}
250+
245251
@Override
246252
public boolean isTimedOut() {
247253
return timedOut;

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.