-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
2,430 additions
and
174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
...http2/src/main/java/com/jauntsdn/netty/handler/codec/http2/websocketx/Http2WebSocket.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* | ||
* Copyright 2020 - present Maksym Ostroverkhov. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.jauntsdn.netty.handler.codec.http2.websocketx; | ||
|
||
import io.netty.buffer.ByteBuf; | ||
import io.netty.channel.ChannelHandlerContext; | ||
import io.netty.handler.codec.http2.Http2Exception; | ||
import io.netty.handler.codec.http2.Http2Flags; | ||
import io.netty.handler.codec.http2.Http2FrameAdapter; | ||
import io.netty.handler.codec.http2.Http2FrameListener; | ||
|
||
interface Http2WebSocket extends Http2FrameListener { | ||
|
||
void trySetWritable(); | ||
|
||
void fireExceptionCaught(Throwable t); | ||
|
||
void streamClosed(); | ||
|
||
void closeForcibly(); | ||
|
||
Http2WebSocket CLOSED = new Http2WebSocketClosedChannel(); | ||
|
||
class Http2WebSocketClosedChannel extends Http2FrameAdapter implements Http2WebSocket { | ||
|
||
@Override | ||
public void streamClosed() {} | ||
|
||
@Override | ||
public void trySetWritable() {} | ||
|
||
@Override | ||
public void fireExceptionCaught(Throwable t) {} | ||
|
||
@Override | ||
public void closeForcibly() {} | ||
|
||
@Override | ||
public int onDataRead( | ||
ChannelHandlerContext ctx, int streamId, ByteBuf data, int padding, boolean endOfStream) | ||
throws Http2Exception { | ||
int processed = super.onDataRead(ctx, streamId, data, padding, endOfStream); | ||
data.release(); | ||
return processed; | ||
} | ||
|
||
@Override | ||
public void onUnknownFrame( | ||
ChannelHandlerContext ctx, | ||
byte frameType, | ||
int streamId, | ||
Http2Flags flags, | ||
ByteBuf payload) { | ||
payload.release(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.