diff options
author | Preston Cody <codeman@gentoo.org> | 2007-12-30 02:44:17 +0000 |
---|---|---|
committer | Preston Cody <codeman@gentoo.org> | 2007-12-30 02:44:17 +0000 |
commit | 2ab61de7b4fde6f783722773c7fb3845cb51b9fa (patch) | |
tree | db3c148e10bbd12f6f2676087f4270676ec87116 /server | |
parent | remove END block as it seems unnecessary, since it looks like ssh dies by its... (diff) | |
download | scire-2ab61de7b4fde6f783722773c7fb3845cb51b9fa.tar.gz scire-2ab61de7b4fde6f783722773c7fb3845cb51b9fa.tar.bz2 scire-2ab61de7b4fde6f783722773c7fb3845cb51b9fa.zip |
removing hte getresponse stuff.
svn path=/branches/new-fu/; revision=278
Diffstat (limited to 'server')
-rwxr-xr-x | server/scireserver.pl | 83 |
1 files changed, 35 insertions, 48 deletions
diff --git a/server/scireserver.pl b/server/scireserver.pl index 358ba3e..d7181bd 100755 --- a/server/scireserver.pl +++ b/server/scireserver.pl @@ -25,61 +25,48 @@ print STDERR "Connecting to $connect_string\n"; while(<>) { chomp( my $line = $_); - if ($line =~ /^STARTRESPONSE (.+?) (.+)$/) { #If it's multi-line, parse accordingly. - print STDERR "Handling multiline response\n"; - my ($size,$md5) = ($1,$2); - my $full_cmd = ""; - while(<>) { - my $multi_line = $_; - last if $multi_line =~ /^ENDRESPONSE$/; - $full_cmd .= $multi_line; - } - #Verify size and md5. FIXME agaffney can you code this part? - #FIXME code what to do. no use yet. will be used for returning jobs. - - } else { #Handle normal single-line commands. - print STDERR "Handling single-line response\n"; - print STDERR "DEBUG: line is: $line\n"; - if($line =~ /^QUIT$/) { - print "OK\n"; - exit; - } + print STDERR "Handling single-line response\n"; + print STDERR "DEBUG: line is: $line\n"; + if($line =~ /^QUIT$/) { + print "OK\n"; + exit; + } - if ($line =~ /^REGISTER "(.+?)" "(.+)"$/) { - my ($mac,$ip) = ($1, $2); - register_client($mac, $ip); - next; #End switch here. You can go no further. - } + if ($line =~ /^REGISTER "(.+?)" "(.+)"$/) { + my ($mac,$ip) = ($1, $2); + register_client($mac, $ip); + next; #End switch here. You can go no further. + } - if($line =~ /^IDENTIFY (.+)$/) { - my $fingerprint = $1; - identify_client($fingerprint); - next; #End switch here. You can go no further. - } - unless($identified == 1) { - print "ERROR This client has not yet been authorized. Please identify!\n"; - next; - } + if($line =~ /^IDENTIFY (.+)$/) { + my $fingerprint = $1; + identify_client($fingerprint); + next; #End switch here. You can go no further. + } + unless($identified == 1) { + print "ERROR This client has not yet been authorized. Please identify!\n"; + next; + } - if ($line =~ /^GET_JOBS(.*)$/) { - my @existing_jobs = split(/ /,$1) if defined($1); - get_jobs(@existing_jobs); - - } elsif ($line =~ /^GET_JOB (.+)$/) { - my $job = $1; - get_job($job); - - } elsif ($line =~ /^SET_JOB_STATUS (.+?) "(.+)"$/) { - my ($jobid,$status) = ($1, $2); - set_job_status($jobid,$status); - - } else { - print "ERROR This command $line, is unknown. Please try again.\n"; - } + if ($line =~ /^GET_JOBS(.*)$/) { + my @existing_jobs = split(/ /,$1) if defined($1); + get_jobs(@existing_jobs); + + } elsif ($line =~ /^GET_JOB (.+)$/) { + my $job = $1; + get_job($job); + + } elsif ($line =~ /^SET_JOB_STATUS (.+?) "(.+)"$/) { + my ($jobid,$status) = ($1, $2); + set_job_status($jobid,$status); + + } else { + print "ERROR This command $line, is unknown. Please try again.\n"; } } + sub read_config_file { my $conf_file = shift; open(FH, "< ${conf_file}") or die("Couldn't open the config file ${conf_file}: $!"); |