Skip to content

Commit

Permalink
Catch p2p exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
sipa committed Jan 10, 2012
1 parent 0195702 commit eceeda1
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions bitcoin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,16 +259,21 @@ class CNode {
};

bool TestNode(const CIPPort &cip, int &ban, int &clientV, vector<CAddress>& vAddr) {
CNode node(cip, vAddr);
bool ret = node.Run();
if (!ret) {
ban = node.GetBan();
} else {
try {
CNode node(cip, vAddr);
bool ret = node.Run();
if (!ret) {
ban = node.GetBan();
} else {
ban = 0;
}
clientV = node.GetClientVersion();
// printf("%s: %s!!!\n", cip.ToString().c_str(), ret ? "GOOD" : "BAD");
return ret;
} catch(std::ios_base::failure& e) {
ban = 0;
return false;
}
clientV = node.GetClientVersion();
// printf("%s: %s!!!\n", cip.ToString().c_str(), ret ? "GOOD" : "BAD");
return ret;
}

/*
Expand Down

0 comments on commit eceeda1

Please sign in to comment.