Skip to content

Commit

Permalink
Add asserts while inserting/erasing from client maps in IFMapServer.
Browse files Browse the repository at this point in the history
Add asserts while inserting/erasing from client maps in IFMapServer

Change-Id: Ib105008246166a574d4b86bd8251f9a40832673d
Closes-Bug: #1577503
(cherry picked from commit 37853af)
  • Loading branch information
tkarwa committed May 2, 2016
1 parent 0f4f75c commit 5fdf50a
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/ifmap/ifmap_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,14 @@ void IFMapServer::ClientRegister(IFMapClient *client) {
}
client_indexes_.set(index);

client_map_.insert(make_pair(client->identifier(), client));
index_map_.insert(make_pair(index, client));
std::pair<ClientMap::iterator, bool> cm_ret;
cm_ret = client_map_.insert(make_pair(client->identifier(), client));
assert(cm_ret.second);

std::pair<IndexMap::iterator, bool> im_ret;
im_ret = index_map_.insert(make_pair(index, client));
assert(im_ret.second);

client->Initialize(exporter_.get(), index);
queue_->Join(index);
IFMAP_DEBUG(IFMapServerClientRegUnreg, "Register request for client ",
Expand All @@ -247,8 +253,10 @@ void IFMapServer::ClientUnregister(IFMapClient *client) {
size_t index = client->index();
sender_->CleanupClient(index);
queue_->Leave(index);
index_map_.erase(index);
client_map_.erase(client->identifier());
ImSz_t iret = index_map_.erase(index);
assert(iret == 1);
CmSz_t cret = client_map_.erase(client->identifier());
assert(cret == 1);
client_indexes_.reset(index);
}

Expand Down

0 comments on commit 5fdf50a

Please sign in to comment.