NET-MitM

 view release on metacpan or  search on metacpan

lib/NET/MitM.pm  view on Meta::CPAN

  return undef;
}

sub _pause($){
  select undef,undef,undef,shift;
  return undef;
}

sub _message_from_client_to_server(){ # TODO Too many too similar sub names, some of which maybe should be public
  my $this=shift;
  # optional sleep to reduce risk of split messages
  _pause($this->{defrag_delay}) if $this->{defrag_delay};
  # It would be possible to be more agressive by repeatedly waiting until there is a break, but that would probably err too much towards concatenating seperate messages - especially under load.
  my $msg;
  sysread($this->{CLIENT},$msg,10000);
  # (0 length message means connection closed)
  if(length($msg) == 0) { 
    $this->echo("Client disconnected\n");
    $this->_destroy();
    return;
  }



( run in 1.029 second using v1.01-cache-2.11-cpan-71847e10f99 )