-
-
Notifications
You must be signed in to change notification settings - Fork 209
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reimplement session structure (#869)
* Reimplement session structure Benefits are clear, developers can easily provide custom behaviour by overriding the server and client classes to provide custom channels (like geyser does for localchannel) and also custom channel handlers can be provided, like for ViaVersion support. Transfers were moved to a flag. There are now ClientSession and ServerSession interfaces which extend Session. This way a ServerSession doesn't have connect methods. Binding to UnixDomainSockets or any other type of SocketAddress is now supported and the client can connect to those too. Tcp was renamed to Net because now non-tcp protocols like local channels and udp (for bedrock ViaBedrock) can be used. * Split up server groups and share channel initializer code This allows us to share more code between server and client. Additionally, the split worker groups allow mcpl to handle server packets more closely to vanilla and reduce timeouts during load. * Allow more code sharing for custom implementations * Fill in arbitrary values for remote address if ipv6 client connects to ipv4 server and vice verse * Use proper separator for ipv6 * Fix channel method signature * Update protocol/src/main/java/org/geysermc/mcprotocollib/protocol/ClientListener.java Co-authored-by: chris <[email protected]> * Update protocol/src/main/java/org/geysermc/mcprotocollib/protocol/ClientListener.java Co-authored-by: chris <[email protected]> * Update protocol/src/main/java/org/geysermc/mcprotocollib/network/net/NetClientSession.java Co-authored-by: chris <[email protected]> * Add log * Implement resolving InetSocketAddresses is unresolved * Rename net package and drop prefix for most classes * Move session and server into their own packages * Rename Net prefix to network * Add ClientNetworkSession factory and pass props properly when following redirects --------- Co-authored-by: chris <[email protected]>
- Loading branch information
1 parent
1daf036
commit edc2323
Showing
32 changed files
with
738 additions
and
492 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
29 changes: 29 additions & 0 deletions
29
protocol/src/main/java/org/geysermc/mcprotocollib/network/ClientSession.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,29 @@ | ||
package org.geysermc.mcprotocollib.network; | ||
|
||
import org.checkerframework.checker.nullness.qual.Nullable; | ||
|
||
/** | ||
* A network client session. | ||
*/ | ||
public interface ClientSession extends Session { | ||
/** | ||
* Connects this session to its host and port. | ||
*/ | ||
default void connect() { | ||
connect(true); | ||
} | ||
|
||
/** | ||
* Connects this session to its host and port. | ||
* | ||
* @param wait Whether to wait for the connection to be established before returning. | ||
*/ | ||
void connect(boolean wait); | ||
|
||
/** | ||
* Get the proxy used by this session. | ||
* | ||
* @return The proxy used by this session. | ||
*/ | ||
@Nullable ProxyInfo getProxy(); | ||
} |
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
7 changes: 7 additions & 0 deletions
7
protocol/src/main/java/org/geysermc/mcprotocollib/network/ServerSession.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,7 @@ | ||
package org.geysermc.mcprotocollib.network; | ||
|
||
/** | ||
* A network server session. | ||
*/ | ||
public interface ServerSession extends Session { | ||
} |
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.