[Pkg-privacy-commits] [msva-perl] 177/356: handle non-responsive agents more politely

Ximin Luo infinity0 at moszumanska.debian.org
Mon Aug 24 07:41:53 UTC 2015


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch debian
in repository msva-perl.

commit d3db08e0baf3457b9b8966af3a556bc4e2d7112b
Author: Daniel Kahn Gillmor <dkg at fifthhorseman.net>
Date:   Mon Oct 18 01:12:11 2010 -0400

    handle non-responsive agents more politely
---
 Crypt/Monkeysphere/MSVA/Client.pm |  5 ++++-
 msva-query-agent                  | 15 +++++++--------
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/Crypt/Monkeysphere/MSVA/Client.pm b/Crypt/Monkeysphere/MSVA/Client.pm
index 0d91aad..8b6e514 100644
--- a/Crypt/Monkeysphere/MSVA/Client.pm
+++ b/Crypt/Monkeysphere/MSVA/Client.pm
@@ -79,7 +79,10 @@
     my $response = $ua->request($request);
 
     my $status = $response->status_line;
-    my $ret = from_json($response->content);
+    my $ret;
+    if ($status eq '200 OK') {
+      $ret = from_json($response->content);
+    }
 
     return $status, $ret;
   }
diff --git a/msva-query-agent b/msva-query-agent
index 846d27d..1c77282 100755
--- a/msva-query-agent
+++ b/msva-query-agent
@@ -35,15 +35,14 @@ my $pkcdata = do {
 my ($status,$ret) = Crypt::Monkeysphere::MSVA::Client->query_agent($context,$peer,$pkctype, $pkcdata, $ENV{MONKEYSPHERE_VALIDATION_AGENT_SOCKET});
 
 msvalog('info', "status: %s\n", $status);
-msvalog('info', "valid: %s\n", $ret->{valid});
-msvalog('info', "message: %s\n", $ret->{message});
-
-if ($ret->{valid}) {
-    exit 0;
-}
-else {
-    exit 1;
+if (defined $ret) {
+  msvalog('info', "valid: %s\n", $ret->{valid});
+  msvalog('fatal', "message: %s\n", $ret->{message});
+  exit 0
+    if ($ret->{valid});
 }
+exit 1;
+
 __END__
 
 =head1 NAME

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/msva-perl.git



More information about the Pkg-privacy-commits mailing list