feat: add custom frame decoder support for custom packet splitting#397
Closed
valiner wants to merge 2 commits intoaceld:masterfrom
Closed
feat: add custom frame decoder support for custom packet splitting#397valiner wants to merge 2 commits intoaceld:masterfrom
valiner wants to merge 2 commits intoaceld:masterfrom
Conversation
…ug disabled - Add IsDebugEnabled() method to ILogger interface and ZinxLoggerCore - Wrap hex.EncodeToString() calls with IsDebugEnabled() check - This prevents unnecessary hex encoding when debug logging is disabled - Fixes issue aceld#366 Affected files: - zlog/ziface/ilogger.go: Add IsDebugEnabled() interface - zlog/logger_core.go: Implement IsDebugEnabled() - zlog/default.go: Add IsDebugEnabled() to default logger - zlog/stdzlog.go: Add global IsDebugEnabled() - znet/msghandler.go, connection.go, kcp_connection.go, ws_connection.go - zdecoder/htlvcrcdecoder.go - examples/zinx_decoder/
…itting
This feature allows users to define custom frame decoders for handling
packet splitting without length field information.
Changes:
- Add SetFrameDecoder/GetFrameDecoder methods to IServer interface
- Add SetFrameDecoder/GetFrameDecoder methods to IClient interface
- Add frameDecoder field to Server and Client structs
- Update Connection, KcpConnection, WsConnection to use custom frame decoder
- Add example demonstrating custom frame decoder usage
Usage:
// Create custom frame decoder
type CustomFrameDecoder struct{}
func (d *CustomFrameDecoder) Decode(buff []byte) [][]byte {
// Split by '\r' delimiter
...
}
// Use with server
server := zinx.NewServer()
server.SetFrameDecoder(&CustomFrameDecoder{})
server.Serve()
This resolves issue aceld#384.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR resolves issue #384
Allow users to define custom frame decoders for handling packet splitting without length field information.
Changes: