Changeset 682


Ignore:
Timestamp:
09/03/15 09:20:45 (6 years ago)
Author:
rlacroix
Message:

Improve the error messages when the server receives incoherent events.

Suggested by Stéphane SENESI.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/event_server.cpp

    r591 r682  
    77namespace xios 
    88{ 
    9  
    10   void CEventServer::push(int rank,CServerBuffer* serverBuffer,char* startBuffer,int size) 
     9  void CEventServer::push(int rank, CServerBuffer* serverBuffer, char* startBuffer, int size) 
    1110  { 
    12     CBufferIn buffer(startBuffer,size) ; 
    13     size_t timeLine ; 
    14     int myClassId ; 
    15     int myType ; 
    16     int myNbSender ; 
     11    CBufferIn buffer(startBuffer, size); 
     12    size_t timeLine; 
     13    int myClassId, myType, myNbSender; 
    1714   
    18     buffer>>size>>timeLine>>myNbSender>>myClassId>>myType ; 
     15    buffer >> size >> timeLine >> myNbSender >> myClassId >> myType; 
    1916   
    2017    if (subEvents.empty()) 
    2118    {   
    22       nbSender=myNbSender ; 
    23       classId=myClassId; 
    24       type=myType ; 
     19      nbSender = myNbSender; 
     20      classId = myClassId; 
     21      type = myType; 
    2522    } 
    2623    else 
    2724    { 
    28       if (nbSender!=myNbSender || classId!=myClassId || type!=myType) 
    29         ERROR("void CEventServer::push(int rank,char* startBuffer,int size)", 
    30              "Callers of an event are not coherent") ; 
     25      if (classId != myClassId || type != myType || nbSender != myNbSender) 
     26        ERROR("void CEventServer::push(int rank, CServerBuffer* serverBuffer, char* startBuffer, int size)", 
     27              << "The callers of event " << timeLine << " are not coherent." << std::endl 
     28              << "Received subevent: classId = " << myClassId << ", type = " << myType << ", nbSender = " << myNbSender << std::endl 
     29              << "Excepted subevent: classId = " << classId << ", type = " << type << ", nbSender = " << nbSender); 
    3130    } 
    3231 
    33     SSubEvent ev ; 
    34     ev.rank=rank ; 
    35     ev.serverBuffer=serverBuffer ; 
    36     ev.buffer=new CBufferIn(buffer.ptr(),buffer.remain()) ; 
    37     ev.size=size  
    38     subEvents.push_back(ev) ; 
     32    SSubEvent ev; 
     33    ev.rank = rank; 
     34    ev.serverBuffer = serverBuffer; 
     35    ev.buffer = new CBufferIn(buffer.ptr(), buffer.remain()); 
     36    ev.size = size 
     37    subEvents.push_back(ev); 
    3938   
    40     if (subEvents.size()>nbSender) 
     39    if (subEvents.size() > nbSender) 
    4140    { 
    42         ERROR("void CEventServer::push(int rank,CServerBuffer* serverBuffer,char* startBuffer,int size)", 
    43               "Callers of an event are not coherent") ; 
     41        ERROR("void CEventServer::push(int rank, CServerBuffer* serverBuffer, char* startBuffer, int size)", 
     42              << "The callers of event " << timeLine << " are not coherent." << std::endl 
     43              << "Too many subevents have been received (" << subEvents.size() << " instead of " << nbSender << ")."); 
    4444    } 
    45    
    4645  } 
    4746 
    4847  bool CEventServer::isFull(void)   
    4948  { 
    50     return (nbSender==subEvents.size()) ; 
     49    return (nbSender == subEvents.size()); 
    5150  } 
    5251 
     
    5453  { 
    5554    list<SSubEvent>::iterator it; 
    56  
    57     for(it=subEvents.begin();it!=subEvents.end();it++) 
     55    for (it = subEvents.begin(); it != subEvents.end(); it++) 
    5856    { 
    59       it->serverBuffer->freeBuffer(it->size) ; 
    60       delete it->buffer ; 
     57      it->serverBuffer->freeBuffer(it->size); 
     58      delete it->buffer; 
    6159    } 
    6260  } 
    63  
    6461} 
Note: See TracChangeset for help on using the changeset viewer.