/[Sack]/trunk/bin/sack.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/bin/sack.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 24 by dpavlin, Tue Sep 22 21:27:13 2009 UTC revision 28 by dpavlin, Tue Sep 22 22:28:40 2009 UTC
# Line 11  use File::Slurp; Line 11  use File::Slurp;
11  use Getopt::Long;  use Getopt::Long;
12  use IO::Socket::INET;  use IO::Socket::INET;
13  use Storable qw/freeze thaw/;  use Storable qw/freeze thaw/;
14    use Digest::MD5 qw/md5/;
15    
16    
17  my $debug  = 0;  my $debug  = 0;
# Line 66  my $input = WebPAC::Input::ISI->new( Line 67  my $input = WebPAC::Input::ISI->new(
67          limit  => $limit,          limit  => $limit,
68  );  );
69    
70    our $num_records = $input->size;
71    
72  sub report {  sub report {
73          my $description = shift;          my $description = shift;
# Line 128  sub get_node { Line 130  sub get_node {
130  sub send_sock {  sub send_sock {
131          my ( $sock, $data ) = @_;          my ( $sock, $data ) = @_;
132          my $size   = length $data;          my $size   = length $data;
133          warn ">>>> $listen ", $sock->peerhost, " $size bytes";          warn ">>>> $listen ", $sock->peerhost, " $size bytes\n";
134          print $sock "$size\n$data" || warn "can't send $size bytes to ", $sock->peerhost;          print $sock "$size\n$data" || warn "can't send $size bytes to ", $sock->peerhost;
135  }  }
136    
# Line 254  if ( $listen ) { Line 256  if ( $listen ) {
256    
257          while (1) {          while (1) {
258    
259                  warn "NODE $listen ready - wating for connection\n";                  warn "NODE $listen ready - path: $path offset: $offset limit: $limit #recs: $num_records\n";
260    
261                  my $client = $sock->accept();                  my $client = $sock->accept();
262    
# Line 272  if ( $listen ) { Line 274  if ( $listen ) {
274                          run_code $header[1] => $content;                          run_code $header[1] => $content;
275                          send_sock $client => freeze $out;                          send_sock $client => freeze $out;
276                  } elsif ( $header[0] eq 'info' ) {                  } elsif ( $header[0] eq 'info' ) {
277                          my $info = "$listen\t$offset\t$limit\t$path";                          my $info = "$listen\t$offset\t$limit\t$num_records\t$path";
278                          $info .= "\t" . eval $header[1] if $header[1];                          $info .= "\t" . eval $header[1] if $header[1];
279                          warn "info $info\n";                          warn "info $info\n";
280                          send_sock $client => $info;                          send_sock $client => $info;
# Line 311  __HELP__ Line 313  __HELP__
313                  send_nodes 'info' => $2;                  send_nodes 'info' => $2;
314    
315                  my @info = (                  my @info = (
316                          "node\toffset\tlimit\tpath",                          "node\toffset\tlimit\t#recs\tpath",
317                          "----\t------\t-----\t----",                          "----\t------\t-----\t-----\t----",
318                          "0\t$offset\t$limit\t$path",                          "0\t$offset\t$limit\t$num_records\t$path",
319                  );                  );
320    
321                  push @info, get_node $_ foreach @nodes;                  push @info, get_node $_ foreach @nodes;

Legend:
Removed from v.24  
changed lines
  Added in v.28

  ViewVC Help
Powered by ViewVC 1.1.26