Index: XIOS3/trunk/src/buffer_server.cpp
===================================================================
--- XIOS3/trunk/src/buffer_server.cpp	(revision 2557)
+++ XIOS3/trunk/src/buffer_server.cpp	(revision 2558)
@@ -9,6 +9,6 @@
 {
 
-  CServerBuffer::CServerBuffer(vector<CWindowDynamic*>& windows, vector<MPI_Aint>& winAddress, int windowsRank, StdSize buffSize) 
-  : hasWindows(true), windows_(windows), windowsRank_(windowsRank), winAddress_(winAddress)
+  CServerBuffer::CServerBuffer(int clientRank, vector<CWindowDynamic*>& windows, vector<MPI_Aint>& winAddress, int windowsRank, StdSize buffSize) 
+  : hasWindows(true), clientRank_(clientRank), windows_(windows), windowsRank_(windowsRank), winAddress_(winAddress)
   {
     size = 3 * buffSize;
@@ -240,5 +240,5 @@
     bool ok=false ;
     
-   
+    info(100)<<"getBufferFromClient : check data in client buffer  : clientRank "<<clientRank_<<" timeline "<<timeLine<<" ??"<< endl ;
     lockBuffer(); 
     CTimer::get("getBufferFromClient_locked").resume() ;   
@@ -272,5 +272,5 @@
       for(size_t i=(count<10)?0:count-10; i<count ; i++) checksumLast=checksumLast+buffer[i] ;
       
-      info(40)<<"getBufferFromClient timeLine==clientTimeLine: windowsRank "<<windowsRank_<<" timeline "<<timeLine<<" clientTimeline "
+      info(40)<<"getBufferFromClient timeLine==clientTimeLine: clientRank "<<clientRank_<<" timeline "<<timeLine<<" clientTimeline "
               <<clientTimeline<<" clientCount "<<count<<" checksum "<<(int)checksum<<" "
               <<(int)buffer[0]<<" "<<(int)buffer[1]<<" "<<(int)buffer[2]<<" "<<(int)buffer[3]<<" "<<(int)buffer[4]<<" "<<(int)buffer[5]<<" " 
@@ -286,5 +286,7 @@
       unlockBuffer() ;
     }
-    CTimer::get("getBufferFromClient").suspend() ;   
+    CTimer::get("getBufferFromClient").suspend() ;  
+    info(100)<<"getBufferFromClient : check data in client buffer ==> done"<<endl ;
+
     if (ok) return true ;
 
Index: XIOS3/trunk/src/buffer_server.hpp
===================================================================
--- XIOS3/trunk/src/buffer_server.hpp	(revision 2557)
+++ XIOS3/trunk/src/buffer_server.hpp	(revision 2558)
@@ -15,5 +15,5 @@
   {
     public:
-      CServerBuffer(vector<CWindowDynamic*>& windows, vector<MPI_Aint>& winAddress, int windowsRank, StdSize bufSize) ;
+      CServerBuffer(int clientRank, vector<CWindowDynamic*>& windows, vector<MPI_Aint>& winAddress, int windowsRank, StdSize bufSize) ;
       ~CServerBuffer() ;
 
@@ -44,4 +44,5 @@
       int currentWindows ;
       bool hasWindows ;
+      int clientRank_ ; // for debugging
       int windowsRank_ ;
       double bufferFromClientLatency_=1e-1 ;
Index: XIOS3/trunk/src/transport/legacy_context_server.cpp
===================================================================
--- XIOS3/trunk/src/transport/legacy_context_server.cpp	(revision 2557)
+++ XIOS3/trunk/src/transport/legacy_context_server.cpp	(revision 2558)
@@ -140,5 +140,5 @@
       MPI_Barrier(winComm_[rank]) ;
 
-      it=(buffers.insert(pair<int,CServerBuffer*>(rank,new CServerBuffer(windows_[rank], winBufferAddress, 0, buffSize)))).first;
+      it=(buffers.insert(pair<int,CServerBuffer*>(rank, new CServerBuffer(rank, windows_[rank], winBufferAddress, 0, buffSize)))).first;
       lastTimeLine[rank]=0 ;
       itLastTimeLine=lastTimeLine.begin() ;
@@ -280,5 +280,5 @@
         windows_[rank][0] -> setWinBufferAddress(winBufferAdress[0],0) ;
         windows_[rank][1] -> setWinBufferAddress(winBufferAdress[1],0) ;
-        buffers[rank] = new CServerBuffer(windows_[rank], winBufferAdress, 0, newSize) ;
+        buffers[rank] = new CServerBuffer(rank, windows_[rank], winBufferAdress, 0, newSize) ;
         info(100)<<"Context id "<<context->getId()<<" : Receive ChangeBufferSize from client rank "<<rank
                  <<"  newSize : "<<newSize<<" Address : "<<winBufferAdress[0]<<" & "<<winBufferAdress[1]<<endl ;
Index: XIOS3/trunk/src/transport/one_sided_client_buffer.hpp
===================================================================
--- XIOS3/trunk/src/transport/one_sided_client_buffer.hpp	(revision 2557)
+++ XIOS3/trunk/src/transport/one_sided_client_buffer.hpp	(revision 2558)
@@ -194,5 +194,5 @@
       size_t fixedSize_ = 0 ;
       size_t currentBufferSize_= 0  ;
-      double growingFactor_ = 2. ; 
+      double growingFactor_ = 1.2 ; 
       MPI_Aint lastFreedBloc_=0 ;
       bool isFinalized_ = false ;
Index: XIOS3/trunk/src/transport/one_sided_server_buffer.hpp
===================================================================
--- XIOS3/trunk/src/transport/one_sided_server_buffer.hpp	(revision 2557)
+++ XIOS3/trunk/src/transport/one_sided_server_buffer.hpp	(revision 2558)
@@ -131,6 +131,6 @@
       size_t fixedSize_ = 0 ;
       size_t currentBufferSize_=0 ;
-      double growingFactor_ = 2. ;
-      double bufferServerFactor_=10. ;
+      double growingFactor_ = 1.2 ;
+      double bufferServerFactor_=1. ;
       
       std::list<CBuffer*> buffers_ ;
Index: XIOS3/trunk/src/transport/p2p_client_buffer.cpp
===================================================================
--- XIOS3/trunk/src/transport/p2p_client_buffer.cpp	(revision 2557)
+++ XIOS3/trunk/src/transport/p2p_client_buffer.cpp	(revision 2558)
@@ -72,4 +72,5 @@
   bool CP2pClientBuffer::isBufferFree(size_t size)
   {
+    if (sentBlocRequest_.size()> maxSentBlocRequests_) return false ;
     if (buffers_.size()>maxWindows_-1) return false ; 
     CBuffer* buffer ;
@@ -168,4 +169,12 @@
   {
     SBloc& bloc = blocs_.front() ;
+    
+    if (info.isActive(logProtocol))
+    {
+      size_t checksum=0 ;
+      for(size_t j=0;j<bloc.count;j++) checksum+=((unsigned char*)(bloc.addr))[j] ;
+      info(logProtocol)<<"free bloc sent to server rank "<<serverRank_<<" : addr="<<bloc.addr<<"  start="<<bloc.start<<"  count="<<bloc.count<<"  checksum="<<checksum<<endl ;
+    }
+
     bloc.buffer->free(bloc.start, bloc.count) ;
     if (bloc.buffer->getCount()==0) 
@@ -243,5 +252,5 @@
       if (flag==false) 
       {
-        ++it ;
+//        ++it ;
         break ;
       }
Index: XIOS3/trunk/src/transport/p2p_client_buffer.hpp
===================================================================
--- XIOS3/trunk/src/transport/p2p_client_buffer.hpp	(revision 2557)
+++ XIOS3/trunk/src/transport/p2p_client_buffer.hpp	(revision 2558)
@@ -41,5 +41,5 @@
           if (count_>0) ERROR("COneSidedClientBuffer::~CBuffer()",<<"Try to delete buffer that is not empty"<<std::endl) ;
           //MPI_Win_detach(window_, buffer_) ;
-          //MPI_Free_mem(buffer_) ;
+          MPI_Free_mem(buffer_) ;
           info(logProtocol)<<"Detach memory from windows : addr="<<(MPI_Aint)buffer_<<"   count="<<size_<<endl ;
         }
@@ -205,7 +205,8 @@
       size_t fixedSize_ = 0 ;
       size_t currentBufferSize_= 0  ;
-      double growingFactor_ = 2. ; 
+      double growingFactor_ = 1.2 ; 
       MPI_Aint lastFreedBloc_=0 ;
       bool isFinalized_ = false ;
+      int maxSentBlocRequests_ = 10000 ;
 
   } ;
Index: XIOS3/trunk/src/transport/p2p_server_buffer.cpp
===================================================================
--- XIOS3/trunk/src/transport/p2p_server_buffer.cpp	(revision 2557)
+++ XIOS3/trunk/src/transport/p2p_server_buffer.cpp	(revision 2558)
@@ -97,6 +97,6 @@
     if (pendingRmaRequests_.empty()) transferEvents() ;
 
-    if (!isLocked_)
-    {
+    //if (!isLocked_)
+    //{
       if (lastBlocToFree_!=0)
       {
@@ -110,5 +110,5 @@
         lastBlocToFree_ = 0 ;        
       }
-    }
+    //}
 
     if (buffers_.size()>1) 
@@ -164,4 +164,12 @@
                            << "  Bandwith : "<< transferedSize/time<< "byte/s"<<endl ;
           CTimer::get("lastTransfer from "+std::to_string(clientRank_)).reset() ;
+          for(int i=0;i<pendingRmaAddr_.size();i++)
+          {
+            size_t checksum=0 ;
+            unsigned char* buffer = (unsigned char*) pendingRmaAddr_[i] ;
+            for(size_t j=0;j<pendingRmaCount_[i];j++) checksum += buffer[j] ;
+            info(logProtocol)<<"Bloc transfered to adrr="<<(void*) buffer<<"  count="<<pendingRmaCount_[i]<<"  checksum="<<checksum<<endl ;
+          }
+
          }
 
@@ -170,4 +178,5 @@
         pendingRmaStatus_.clear() ;
         pendingRmaCount_.clear() ;
+        pendingRmaAddr_.clear() ;
         completedEvents_.insert(onTransferEvents_.begin(),onTransferEvents_.end()) ;
         
@@ -381,4 +390,5 @@
     pendingRmaRequests_.push_back(request) ;
     pendingRmaCount_.push_back(count) ;
+    pendingRmaAddr_.push_back(buffer->getBuffer()+start) ;
     onTransferEvents_[timeline].push_back({buffer,start,count,addr}) ;
   }
Index: XIOS3/trunk/src/transport/p2p_server_buffer.hpp
===================================================================
--- XIOS3/trunk/src/transport/p2p_server_buffer.hpp	(revision 2557)
+++ XIOS3/trunk/src/transport/p2p_server_buffer.hpp	(revision 2558)
@@ -133,6 +133,6 @@
       size_t fixedSize_ = 0 ;
       size_t currentBufferSize_=0 ;
-      double growingFactor_ = 2. ;
-      double bufferServerFactor_=10. ;
+      double growingFactor_ = 1.2 ;
+      double bufferServerFactor_=1. ;
       
       std::list<CBuffer*> buffers_ ;
@@ -147,4 +147,5 @@
       vector<MPI_Request> pendingRmaRequests_ ;
       vector<MPI_Status> pendingRmaStatus_ ;
+      vector<char*> pendingRmaAddr_ ;
       vector<int> pendingRmaCount_ ;
 
@@ -164,5 +165,5 @@
 
       MPI_Win winControl_ ;
-      bool isLocked_=false ;
+      //bool isLocked_=false ;
       const int windowRank_=0 ;
       MPI_Aint lastBlocToFree_=0 ;
