From f900f68cf25a3fb9416bf3f863ce0f70c891abda Mon Sep 17 00:00:00 2001 From: LossyDragon Date: Tue, 15 Oct 2024 20:23:01 -0500 Subject: [PATCH] Remove CMList --- .../dragonbra/javasteam/steam/CMClient.java | 28 +------------------ .../steam/steamclient/SteamClient.kt | 10 +------ .../steamclient/callbacks/CMListCallback.kt | 28 ------------------- .../steamd/in/dragonbra/javasteam/emsg.steamd | 2 +- 4 files changed, 3 insertions(+), 65 deletions(-) delete mode 100644 src/main/java/in/dragonbra/javasteam/steam/steamclient/callbacks/CMListCallback.kt diff --git a/src/main/java/in/dragonbra/javasteam/steam/CMClient.java b/src/main/java/in/dragonbra/javasteam/steam/CMClient.java index 35dae123..2bf2c495 100644 --- a/src/main/java/in/dragonbra/javasteam/steam/CMClient.java +++ b/src/main/java/in/dragonbra/javasteam/steam/CMClient.java @@ -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); @@ -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; @@ -379,7 +375,7 @@ private void handleMulti(IPacketMsg packetMsg) { } } } catch (IOException e) { - e.printStackTrace(); + logger.error("error in handleMulti()", e); } } @@ -428,28 +424,6 @@ private void handleLoggedOff(IPacketMsg packetMsg) { } } - private void handleCMList(IPacketMsg packetMsg) { - ClientMsgProtobuf cmMsg = new ClientMsgProtobuf<>(CMsgClientCMList.class, packetMsg); - - if (cmMsg.getBody().getCmPortsCount() != cmMsg.getBody().getCmAddressesCount()) { - logger.debug("HandleCMList received malformed message"); - } - - List addresses = cmMsg.getBody().getCmAddressesList(); - List ports = cmMsg.getBody().getCmPortsList(); - - List 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 sessToken = new ClientMsgProtobuf<>(CMsgClientSessionToken.class, packetMsg); diff --git a/src/main/java/in/dragonbra/javasteam/steam/steamclient/SteamClient.kt b/src/main/java/in/dragonbra/javasteam/steam/steamclient/SteamClient.kt index 043f1344..c8c34065 100644 --- a/src/main/java/in/dragonbra/javasteam/steam/steamclient/SteamClient.kt +++ b/src/main/java/in/dragonbra/javasteam/steam/steamclient/SteamClient.kt @@ -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 @@ -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 @@ -259,13 +257,7 @@ class SteamClient @JvmOverloads constructor( postCallback(DisconnectedCallback(userInitiated)) } -// fun clearHandlerCaches() - - private fun handleCMList(packetMsg: IPacketMsg) { - val cmMsg = ClientMsgProtobuf(CMsgClientCMList::class.java, packetMsg) - - CMListCallback(cmMsg.body).let(::postCallback) - } + // fun clearHandlerCaches() private fun handleJobHeartbeat(packetMsg: IPacketMsg) { JobID(packetMsg.getTargetJobID()).let(jobManager::heartbeatJob) diff --git a/src/main/java/in/dragonbra/javasteam/steam/steamclient/callbacks/CMListCallback.kt b/src/main/java/in/dragonbra/javasteam/steam/steamclient/callbacks/CMListCallback.kt deleted file mode 100644 index 7bda2f53..00000000 --- a/src/main/java/in/dragonbra/javasteam/steam/steamclient/callbacks/CMListCallback.kt +++ /dev/null @@ -1,28 +0,0 @@ -package `in`.dragonbra.javasteam.steam.steamclient.callbacks - -import `in`.dragonbra.javasteam.protobufs.steamclient.SteammessagesClientserver.CMsgClientCMList -import `in`.dragonbra.javasteam.steam.discovery.ServerRecord -import `in`.dragonbra.javasteam.steam.steamclient.callbackmgr.CallbackMsg -import `in`.dragonbra.javasteam.util.NetHelpers -import java.net.InetSocketAddress - -/** - * This callback is received when the client has received the CM list from Steam. - */ -class CMListCallback(cmMsg: CMsgClientCMList.Builder) : CallbackMsg() { - - /** - * Gets the CM server list. - */ - val servers: List - - init { - val cmList = cmMsg.cmAddressesList.zip(cmMsg.cmPortsList) { address, port -> - ServerRecord.createSocketServer(InetSocketAddress(NetHelpers.getIPAddress(address), port)) - } - - val webSocketList = cmMsg.cmWebsocketAddressesList.map(ServerRecord::createWebSocketServer) - - servers = cmList + webSocketList - } -} diff --git a/src/main/steamd/in/dragonbra/javasteam/emsg.steamd b/src/main/steamd/in/dragonbra/javasteam/emsg.steamd index d8f61da3..a7583cdf 100644 --- a/src/main/steamd/in/dragonbra/javasteam/emsg.steamd +++ b/src/main/steamd/in/dragonbra/javasteam/emsg.steamd @@ -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