testbot/Engine: Simplify the client command dispatching.
Francois Gouget
fgouget at codeweavers.com
Thu Oct 25 11:13:23 CDT 2012
---
testbot/bin/Engine.pl | 66 ++++++++++++++-----------------------------------
1 file changed, 18 insertions(+), 48 deletions(-)
diff --git a/testbot/bin/Engine.pl b/testbot/bin/Engine.pl
index f453927..7834619 100755
--- a/testbot/bin/Engine.pl
+++ b/testbot/bin/Engine.pl
@@ -440,57 +440,27 @@ sub HandleGetScreenshot
return "1" . $ImageBytes;
}
+my %Handlers=(
+ "expectwinetestupdate" => \&HandleExpectWinetestUpdate,
+ "foundwinetestupdate" => \&HandleFoundWinetestUpdate,
+ "getscreenshot" => \&HandleGetScreenshot,
+ "jobcancel" => \&HandleJobCancel,
+ "jobstatuschange" => \&HandleJobStatusChange,
+ "jobsubmit" => \&HandleJobSubmit,
+ "ping" => \&HandlePing,
+ "taskcomplete" => \&HandleTaskComplete,
+ "vmstatuschange" => \&HandleVMStatusChange,
+ "winepatchmlsubmission" => \&HandleWinePatchMLSubmission,
+ "winepatchwebnotification" => \&HandleWinePatchWebNotification,
+ "winepatchwebsubmission" => \&HandleWinePatchWebSubmission,
+ );
+
sub HandleClientCmd
{
my $Cmd = shift;
- if ($Cmd eq "ping")
- {
- return HandlePing(@_);
- }
- if ($Cmd eq "jobsubmit")
- {
- return HandleJobSubmit(@_);
- }
- if ($Cmd eq "jobstatuschange")
- {
- return HandleJobStatusChange(@_);
- }
- if ($Cmd eq "jobcancel")
- {
- return HandleJobCancel(@_);
- }
- if ($Cmd eq "taskcomplete")
- {
- return HandleTaskComplete(@_);
- }
- if ($Cmd eq "vmstatuschange")
- {
- return HandleVMStatusChange(@_);
- }
- if ($Cmd eq "expectwinetestupdate")
- {
- return HandleExpectWinetestUpdate(@_);
- }
- if ($Cmd eq "foundwinetestupdate")
- {
- return HandleFoundWinetestUpdate(@_);
- }
- if ($Cmd eq "winepatchmlsubmission")
- {
- return HandleWinePatchMLSubmission(@_);
- }
- if ($Cmd eq "winepatchwebnotification")
- {
- return HandleWinePatchWebNotification(@_);
- }
- if ($Cmd eq "winepatchwebsubmission")
- {
- return HandleWinePatchWebSubmission(@_);
- }
- if ($Cmd eq "getscreenshot")
- {
- return HandleGetScreenshot(@_);
- }
+
+ my $handler = $Handlers{$Cmd};
+ return &$handler(@_) if (defined $handler);
LogMsg "Unknown command $Cmd\n";
return "0Unknown command $Cmd\n";
--
1.7.10.4
More information about the wine-patches
mailing list