Changeset 260 in flair-src for trunk/tools/FlairGCS/src


Ignore:
Timestamp:
Jul 26, 2018, 2:44:42 PM (6 years ago)
Author:
Sanahuja Guillaume
Message:

gcs: do not use socket if connection lost

Location:
trunk/tools/FlairGCS/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/FlairGCS/src/ConnectionLayout.cpp

    r258 r260  
    1616
    1717ConnectionLayout::~ConnectionLayout() {
     18}
     19
     20void ConnectionLayout::udtSocketDestroyed(QObject *obj){
     21  socket=NULL;
    1822}
    1923
     
    6670void ConnectionLayout::XmlToSend(QDomDocument doc) {
    6771   //fprintf(stderr,"xml to send\n%s\n",doc.toString().toLocal8Bit().constData());
     72  if(!socket) return;
    6873 
    6974  // xml to send a mettre dans le manager
  • trunk/tools/FlairGCS/src/ConnectionLayout.h

    r248 r260  
    3333private slots:
    3434  void receive(char *buf, int size);
     35  void udtSocketDestroyed(QObject *obj);
    3536
    3637signals:
  • trunk/tools/FlairGCS/src/Manager.cpp

    r255 r260  
    154154  connect(newLayout, SIGNAL(destroyed(QObject *)), this, SLOT(layoutDestroyed(QObject *)));
    155155  connect(udtSocket, SIGNAL(destroyed(QObject *)), this, SLOT(udtSocketDestroyed(QObject *)));
     156  connect(udtSocket, SIGNAL(destroyed(QObject *)), newLayout, SLOT(udtSocketDestroyed(QObject *)));
    156157 
    157158  // widget
     
    187188void Manager::udtSocketDestroyed(QObject *obj) {
    188189  //mark socket as not valid, it can be a connection lost
    189   //in this case we keep the layout for reading, and mark it as problematic
     190  //in this case we keep the layout for reading, and mark it as problematic (socket=NULL)
    190191  for(int i=0;i<connections.count();i++) {
    191192    if(connections.at(i).socket==(UdtSocket *)obj) {
     
    391392void Manager::send(void) {
    392393  for (int i = 0; i < connections.count(); i++) {
    393     QDomDocument doc("remote_ui_xml");
    394     connections.at(i).layout->GetUpdateXml((QDomElement *)&doc);
    395     // fprintf(stderr,"merge\n%s\n",doc.toString().toLocal8Bit().constData());
    396 
    397     connections.at(i).layout->XmlToSend(doc);
     394    if(connections.at(i).socket!=NULL) {
     395      QDomDocument doc("remote_ui_xml");
     396      connections.at(i).layout->GetUpdateXml((QDomElement *)&doc);
     397      // fprintf(stderr,"merge\n%s\n",doc.toString().toLocal8Bit().constData());
     398
     399      connections.at(i).layout->XmlToSend(doc);
     400    }
    398401  }
    399402}
Note: See TracChangeset for help on using the changeset viewer.