-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added MatchmakeExtension::AutoMatchmakeWithParam_Postpone
- Loading branch information
Showing
3 changed files
with
83 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package matchmake_extension | ||
|
||
import ( | ||
nex "github.com/PretendoNetwork/nex-go" | ||
"github.com/PretendoNetwork/nex-protocols-go/globals" | ||
match_making "github.com/PretendoNetwork/nex-protocols-go/match-making" | ||
) | ||
|
||
// AutoMatchmakeWithParam_Postpone sets the AutoMatchmakeWithParam_Postpone handler function | ||
func (protocol *MatchmakeExtensionProtocol) AutoMatchmakeWithParam_Postpone(handler func(err error, client *nex.Client, callID uint32, autoMatchmakeParam *match_making.AutoMatchmakeParam)) { | ||
protocol.AutoMatchmakeWithParam_PostponeHandler = handler | ||
} | ||
|
||
func (protocol *MatchmakeExtensionProtocol) HandleAutoMatchmakeWithParam_Postpone(packet nex.PacketInterface) { | ||
if protocol.AutoMatchmakeWithParam_PostponeHandler == nil { | ||
globals.Logger.Warning("MatchmakeExtension::AutoMatchmakeWithParam_Postpone not implemented") | ||
go globals.RespondNotImplemented(packet, ProtocolID) | ||
return | ||
} | ||
|
||
client := packet.Sender() | ||
request := packet.RMCRequest() | ||
|
||
callID := request.CallID() | ||
parameters := request.Parameters() | ||
|
||
parametersStream := nex.NewStreamIn(parameters, protocol.Server) | ||
|
||
autoMatchmakeParam, err := parametersStream.ReadStructure(match_making.NewAutoMatchmakeParam()) | ||
if err != nil { | ||
go protocol.AutoMatchmakeWithParam_PostponeHandler(err, client, callID, nil) | ||
return | ||
} | ||
|
||
go protocol.AutoMatchmakeWithParam_PostponeHandler(nil, client, callID, autoMatchmakeParam.(*match_making.AutoMatchmakeParam)) | ||
} |
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