Navigation Menu

Skip to content

Commit

Permalink
implement debug messages in client too
Browse files Browse the repository at this point in the history
  • Loading branch information
grantm committed Jun 16, 2012
1 parent 03ff58c commit 2d1d4fa
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions bin/bcvi
Expand Up @@ -675,11 +675,13 @@ sub send_command {


my $sock = $self->connect_to_listener(); my $sock = $self->connect_to_listener();


$sock->write( my $request =
"Auth-Key: " . $self->auth_key . $LF . "Auth-Key: " . $self->auth_key . $LF .
"Host-Alias: " . $self->host_alias . $LF . "Host-Alias: " . $self->host_alias . $LF .
"Command: " . $command . $LF "Command: " . $command . $LF;
) or die "Error sending command through backchannel: $!"; $self->DEBUG($request);
$sock->write($request)
or die "Error sending command through backchannel: $!";


$self->send_body(\@files); $self->send_body(\@files);
return if $self->check_response() =~ /^(?:200|300)$/; return if $self->check_response() =~ /^(?:200|300)$/;
Expand Down Expand Up @@ -709,6 +711,8 @@ sub check_response {
my($self) = @_; my($self) = @_;


my $response = $self->sock->getline() or die "Server hung up\n"; my $response = $self->sock->getline() or die "Server hung up\n";
chomp($response);
$self->DEBUG("Received response: $response");
if(my($code, $message) = $response =~ m{^(\d\d\d) (.*)$}) { if(my($code, $message) = $response =~ m{^(\d\d\d) (.*)$}) {
($self->{response_code}, $self->{response_message}) = ($code, $message); ($self->{response_code}, $self->{response_message}) = ($code, $message);
$self->read_response() if $code eq '300'; $self->read_response() if $code eq '300';
Expand Down Expand Up @@ -749,6 +753,7 @@ sub connect_to_listener {
my($self) = @_; my($self) = @_;


$self->get_connection_details(); $self->get_connection_details();
$self->DEBUG("Connecting to: " . $self->gateway_address . ':' . $self->port);


my $peer = $self->gateway_address . ':' . $self->port; my $peer = $self->gateway_address . ':' . $self->port;
my $sock = IO::Socket::INET->new( my $sock = IO::Socket::INET->new(
Expand All @@ -757,6 +762,8 @@ sub connect_to_listener {


binmode($sock); binmode($sock);
my $welcome = $sock->getline() or die "No listener?\n"; my $welcome = $sock->getline() or die "No listener?\n";
chomp($welcome);
$self->DEBUG("Server banner: $welcome");
if($welcome =~ /^100 Ready \(([^)]+)\)/) { if($welcome =~ /^100 Ready \(([^)]+)\)/) {
$self->{server_version} = $1; $self->{server_version} = $1;
} }
Expand Down

0 comments on commit 2d1d4fa

Please sign in to comment.