Skip to content

Commit

Permalink
[backend] add $logtimeout feature, just throw "rpc timeout" on timeou…
Browse files Browse the repository at this point in the history
…t again
  • Loading branch information
mlschroe committed May 3, 2016
1 parent 0be419d commit bda7e15
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/backend/BSRPC.pm
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ use strict;

our $useragent = 'BSRPC 0.9.1';
our $noproxy;
our $logtimeout;

my %hostlookupcache;
my %cookiestore; # our session store to keep iChain fast
Expand Down Expand Up @@ -205,7 +206,11 @@ sub rpc {
my %paramcopy = %$param;
my $timeout = delete $paramcopy{'timeout'};
my $ans;
local $SIG{'ALRM'} = sub {alarm(0); die("rpc timeout($timeout sec) uri: '$param->{uri}'\n");};
local $SIG{'ALRM'} = sub {
alarm(0);
print "rpc timeout($timeout sec), uri: '$param->{uri}'\n" if $logtimeout;
die("rpc timeout\n");
};
eval {
eval {
alarm($timeout);
Expand Down

0 comments on commit bda7e15

Please sign in to comment.