Open wongoo opened 4 years ago
there are lot of code that need to consider what kind of the connection, tcp or udp or ws, which let the code logic complex.
So suggest to separate udp/tcp/ws code logic.
For example, a interface can be defined:
type ProtocolHandler interface { handleLoop() handlePackage() }
Assign matched ProtocolHandler to a protocol, not check the type of connection in handler logic, make the logic simple.
A good suggestion. I will do it in some days later.
@wongoo would u try to do it? because i am so familiar with getty that i have no idea how to split them.
there are lot of code that need to consider what kind of the connection, tcp or udp or ws, which let the code logic complex.
So suggest to separate udp/tcp/ws code logic.
For example, a interface can be defined:
Assign matched ProtocolHandler to a protocol, not check the type of connection in handler logic, make the logic simple.