Index: XIOS3/dev/XIOS_FILE_SERVICES/src/manager/ressources_manager.cpp
===================================================================
--- XIOS3/dev/XIOS_FILE_SERVICES/src/manager/ressources_manager.cpp	(revision 2452)
+++ XIOS3/dev/XIOS_FILE_SERVICES/src/manager/ressources_manager.cpp	(revision 2453)
@@ -163,5 +163,5 @@
     buffer.realloc(maxBufferSize_) ;
     
-    buffer<<serverLeader_ ;  
+    buffer<<ressourcesSize_<<freeRessourcesSize_<<serverLeader_ ;  
     buffer<<(int) pools_.size();
     for(auto it=pools_.begin();it!=pools_.end(); ++it)
@@ -169,5 +169,5 @@
       auto key = it->first ;
       auto val = it->second ; 
-      buffer << key<<std::get<0>(val) << std::get<1>(val)  ;
+      buffer << key<<std::get<0>(val)  << std::get<1>(val)  << std::get<2>(val);
     }
   }
@@ -177,7 +177,8 @@
     std::string poolId ;
     int size ;
+    int freeSize ;
     int leader ;
    
-    buffer>>serverLeader_ ;
+    buffer>>ressourcesSize_>>freeRessourcesSize_>>serverLeader_ ;
     pools_.clear() ;
     int nbPools ;
@@ -185,6 +186,6 @@
     for(int i=0;i<nbPools;i++) 
     {
-      buffer>>poolId>>size>>leader ;
-      pools_[poolId]=std::make_tuple(size,leader) ;
+      buffer>>poolId>>size>>freeSize>>leader ;
+      pools_[poolId]=std::make_tuple(size, freeSize, leader) ;
     }
   }
@@ -210,9 +211,18 @@
 
  
-  void CRessourcesManager::registerPool(const string& poolId, int size, int leader)
-  {
-    winRessources_->lockWindow(managerGlobalLeader_,0) ;
-    winRessources_->updateFromWindow(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpIn) ;
-    pools_[poolId] = make_tuple(size,leader) ;
+  void CRessourcesManager::registerPoolClient(const string& poolId, int size, int leader)
+  {
+    winRessources_->lockWindow(managerGlobalLeader_,0) ;
+    winRessources_->updateFromWindow(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpIn) ;
+    pools_[poolId] = make_tuple(size, size, leader) ;
+    winRessources_->updateToWindow(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpOut) ;
+    winRessources_->unlockWindow(managerGlobalLeader_,0) ;    
+  }
+
+  void CRessourcesManager::registerPoolServer(const string& poolId, int size, int leader)
+  {
+    winRessources_->lockWindow(managerGlobalLeader_,0) ;
+    winRessources_->updateFromWindow(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpIn) ;
+    pools_[poolId] = make_tuple(size, size, leader) ;
     freeRessourcesSize_-=size ;
     winRessources_->updateToWindow(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpOut) ;
@@ -220,6 +230,5 @@
   }
 
-
-  bool CRessourcesManager::getPoolInfo(const string& poolId, int& size, int& leader)
+  bool CRessourcesManager::getPoolInfo(const string& poolId, int& size, int& freeSize, int& leader)
   {
     winRessources_->lockWindow(managerGlobalLeader_,0) ;
@@ -232,7 +241,28 @@
     {
       size=get<0>(it->second) ;
-      leader=get<1>(it->second) ;
+      freeSize=get<1>(it->second) ;
+      leader=get<2>(it->second) ;
       return true ;
     }
+  }
+
+  bool CRessourcesManager::decreasePoolFreeSize(const string& poolId, int size)
+  {
+    int ret ;
+
+    winRessources_->lockWindow(managerGlobalLeader_,0) ;
+    winRessources_->updateFromWindow(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpIn) ;
+   
+
+    auto it=pools_.find(poolId) ;
+    
+    if ( it == pools_.end()) ret=false ;
+    else 
+    {
+      get<1>(it->second)-=size ;
+      ret=true ;
+    }
+    winRessources_->updateToWindow(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpOut) ;
+    winRessources_->unlockWindow(managerGlobalLeader_,0) ;    
   }
 
@@ -257,18 +287,29 @@
   bool CRessourcesManager::getPoolLeader(const string& poolId, int& leader)
   {
-    int size ;
-    return getPoolInfo(poolId, size, leader) ;
+    int size, freeSize ;
+    return getPoolInfo(poolId, size, freeSize, leader) ;
   }
 
   bool CRessourcesManager::getPoolSize(const string& poolId, int& size)
   {
-    int leader ;
-    return getPoolInfo(poolId, size, leader) ;
+    int leader,freeSize ;
+    return getPoolInfo(poolId, size, freeSize, leader) ;
+  }
+
+  bool CRessourcesManager::getPoolFreeSize(const string& poolId, int& freeSize)
+  {
+    int leader,size ;
+    return getPoolInfo(poolId, size, freeSize, leader) ;
   }
 
   bool CRessourcesManager::hasPool(const string& poolId)
   {
-    int leader,size ;
-    return getPoolInfo(poolId, size, leader) ;
+    int leader,size,freeSize ;
+    return getPoolInfo(poolId, size, freeSize, leader) ;
+  }
+
+  void CRessourcesManager::waitPoolRegistration(const string& poolId)
+  {
+    while(!hasPool(poolId)) CXios::getDaemonsManager()->servicesEventLoop() ;
   }
 }
