-
Notifications
You must be signed in to change notification settings - Fork 494
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use non-legacy service methods (and some refactoring of messages/packets handling) #1036
Conversation
SteamKit2/SteamKit2/Steam/Handlers/SteamUnifiedMessages/Callbacks.cs
Outdated
Show resolved
Hide resolved
SteamKit2/SteamKit2/Steam/Handlers/SteamUnifiedMessages/Callbacks.cs
Outdated
Show resolved
Hide resolved
@@ -50,13 +50,13 @@ public string RpcName | |||
public string MethodName { get; private set; } | |||
|
|||
|
|||
internal ServiceMethodResponse( JobID jobID, EResult result, CMsgClientServiceMethodLegacyResponse resp ) | |||
internal ServiceMethodResponse( JobID jobID, EResult result, ClientMsgProtobuf response, IPacketMsg packetMsg ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we pass in just the target job name rather than the whole proto message object, considering that all we do with it is immediately dot into the target job name?
Alternatively, why deserialise it to get to the target job name, when PacketClientMsgProtobuf
(IPacketMsg
subclass) has already deserialised the proto header? We shouldn't need to deserialise it twice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So it does. Then why does ClientMsgProtobuf
also deserialize the header?
{ | ||
var response = new ClientMsgProtobuf<CMsgClientServiceMethodLegacyResponse>( packetMsg ); | ||
var callback = new ServiceMethodResponse(response.TargetJobID, (EResult)response.ProtoHeader.eresult, response.Body); | ||
var response = new ClientMsgProtobuf( packetMsg ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above re. deserialising the message twice - the IPacketMsg
object here should already contain what we need.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to contain the raw payload, which would mean I'd still have to skip over the header when deserializing the body.
FYI you mentioned #266, but that issue talks about GC messages which this PR doesn't touch. |
Right, I meant the same concept (since all those message types are very similar) - being able to construct a message by giving it a body, rather than having the message allocate the body and then having to manipulate its properties through the Body getter. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirmed that service methods and service notifications are working with this.
Not sure I like making the header object public though, see comments on that. Perhaps they should be internal
.
Ref: #909
This appears to work, but the implementation is questionable at best. I haven't tested ServiceMethodSendToClient.
GetDeserializedResponse
could be removed if responses were handled similarly to how they're done for notifications here: https://github.com/xPaw/SteamKit/blob/c3964e89564575083dfd30c354394ec13131301c/SteamKit2/SteamKit2/Steam/Handlers/SteamUnifiedMessages/SteamUnifiedMessages.cs#L182However, it will not work if consumers have their own protobufs that SK doesn't have.