From ca5e7f19465c1de1e96c0783b61b7c46fde9b5ef Mon Sep 17 00:00:00 2001 From: "Ruben S. Montero" Date: Sun, 19 Jun 2016 00:38:08 +0200 Subject: [PATCH] Prevent deadlock when reservations fail with the same name. --- src/rm/RequestManagerVirtualNetwork.cc | 2 ++ src/vnm/AddressRange.cc | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/rm/RequestManagerVirtualNetwork.cc b/src/rm/RequestManagerVirtualNetwork.cc index da1859f28b..b8f424254f 100644 --- a/src/rm/RequestManagerVirtualNetwork.cc +++ b/src/rm/RequestManagerVirtualNetwork.cc @@ -450,6 +450,8 @@ void VirtualNetworkReserve::request_execute( if (rvn != 0) { vnpool->drop(rvn, att.resp_msg); + + rvn->unlock(); } } diff --git a/src/vnm/AddressRange.cc b/src/vnm/AddressRange.cc index c3f3cfbf72..ce955264ea 100644 --- a/src/vnm/AddressRange.cc +++ b/src/vnm/AddressRange.cc @@ -630,6 +630,11 @@ int AddressRange::ip_to_i(const string& _ip, unsigned int& i_ip) const string ip = _ip; + if ( ip.find_first_not_of("0123456789.") != std::string::npos ) + { + return -1; + } + while ( (pos = ip.find('.')) != string::npos ) { ip.replace(pos,1," "); @@ -641,11 +646,6 @@ int AddressRange::ip_to_i(const string& _ip, unsigned int& i_ip) const return -1; } - if ( ip.find_first_not_of("0123456789 ") != std::string::npos ) - { - return -1; - } - iss.str(ip); i_ip = 0;