Skip to content

Commit

Permalink
Merge pull request #289 from LossyDragon/rem-cmlist
Browse files Browse the repository at this point in the history
Remove CMList
  • Loading branch information
LossyDragon authored Oct 16, 2024
2 parents 2d3193b + f900f68 commit 71eb8f9
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 65 deletions.
28 changes: 1 addition & 27 deletions src/main/java/in/dragonbra/javasteam/steam/CMClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
* This base client handles the underlying connection to a CM server. This class should not be use directly, but through
* the {@link in.dragonbra.javasteam.steam.steamclient.SteamClient SteamClient} class.
*/
@SuppressWarnings("unused")
public abstract class CMClient {

private static final Logger logger = LogManager.getLogger(CMClient.class);
Expand Down Expand Up @@ -256,9 +255,6 @@ protected boolean onClientMsgReceived(IPacketMsg packetMsg) {
case ClientLoggedOff: // to stop heart beating when we get logged off
handleLoggedOff(packetMsg);
break;
case ClientCMList:
handleCMList(packetMsg);
break;
case ClientSessionToken: // am session token
handleSessionToken(packetMsg);
break;
Expand Down Expand Up @@ -379,7 +375,7 @@ private void handleMulti(IPacketMsg packetMsg) {
}
}
} catch (IOException e) {
e.printStackTrace();
logger.error("error in handleMulti()", e);
}
}

Expand Down Expand Up @@ -428,28 +424,6 @@ private void handleLoggedOff(IPacketMsg packetMsg) {
}
}

private void handleCMList(IPacketMsg packetMsg) {
ClientMsgProtobuf<CMsgClientCMList.Builder> cmMsg = new ClientMsgProtobuf<>(CMsgClientCMList.class, packetMsg);

if (cmMsg.getBody().getCmPortsCount() != cmMsg.getBody().getCmAddressesCount()) {
logger.debug("HandleCMList received malformed message");
}

List<Integer> addresses = cmMsg.getBody().getCmAddressesList();
List<Integer> ports = cmMsg.getBody().getCmPortsList();

List<ServerRecord> cmList = new ArrayList<>();
for (int i = 0; i < Math.min(addresses.size(), ports.size()); i++) {
cmList.add(ServerRecord.createSocketServer(new InetSocketAddress(NetHelpers.getIPAddress(addresses.get(i)), ports.get(i))));
}

for (String s : cmMsg.getBody().getCmWebsocketAddressesList()) {
cmList.add(ServerRecord.createWebSocketServer(s));
}

getServers().replaceList(cmList);
}

private void handleSessionToken(IPacketMsg packetMsg) {
ClientMsgProtobuf<CMsgClientSessionToken.Builder> sessToken = new ClientMsgProtobuf<>(CMsgClientSessionToken.class, packetMsg);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import `in`.dragonbra.javasteam.steam.handlers.steamuserstats.SteamUserStats
import `in`.dragonbra.javasteam.steam.handlers.steamworkshop.SteamWorkshop
import `in`.dragonbra.javasteam.steam.steamclient.callbackmgr.CallbackMsg
import `in`.dragonbra.javasteam.steam.steamclient.callbackmgr.ICallbackMsg
import `in`.dragonbra.javasteam.steam.steamclient.callbacks.CMListCallback
import `in`.dragonbra.javasteam.steam.steamclient.callbacks.ConnectedCallback
import `in`.dragonbra.javasteam.steam.steamclient.callbacks.DisconnectedCallback
import `in`.dragonbra.javasteam.steam.steamclient.configuration.SteamConfiguration
Expand Down Expand Up @@ -212,7 +211,6 @@ class SteamClient @JvmOverloads constructor(

// we want to handle some of the clientMsg's before we pass them along to registered handlers
when (packetMsg.getMsgType()) {
EMsg.ClientCMList -> handleCMList(packetMsg)
EMsg.JobHeartbeat -> handleJobHeartbeat(packetMsg)
EMsg.DestJobFailed -> handleJobFailed(packetMsg)
else -> Unit
Expand Down Expand Up @@ -259,13 +257,7 @@ class SteamClient @JvmOverloads constructor(
postCallback(DisconnectedCallback(userInitiated))
}

// fun clearHandlerCaches()

private fun handleCMList(packetMsg: IPacketMsg) {
val cmMsg = ClientMsgProtobuf<CMsgClientCMList.Builder>(CMsgClientCMList::class.java, packetMsg)

CMListCallback(cmMsg.body).let(::postCallback)
}
// fun clearHandlerCaches()

private fun handleJobHeartbeat(packetMsg: IPacketMsg) {
JobID(packetMsg.getTargetJobID()).let(jobManager::heartbeatJob)
Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion src/main/steamd/in/dragonbra/javasteam/emsg.steamd
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ enum EMsg
ClientLicenseList = 780;
ClientCancelLicenseResponse = 781; removed
ClientVACBanStatus = 782;
ClientCMList = 783;
ClientCMList = 783; removed
ClientEncryptPct = 784;
ClientGetLegacyGameKeyResponse = 785;
ClientFavoritesList = 786; removed
Expand Down

0 comments on commit 71eb8f9

Please sign in to comment.