Changeset 642 in ntrip


Ignore:
Timestamp:
Dec 18, 2007, 4:24:26 PM (16 years ago)
Author:
mervart
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/bncapp.cpp

    r621 r642  
    4343#include <QMessageBox>
    4444#include <cmath>
     45#include <unistd.h>
    4546
    4647#include "bncapp.h"
     
    524525  // ----------------------
    525526  if (_sockets) {
    526     QListIterator<QTcpSocket*> is(*_sockets);
     527    QMutableListIterator<QTcpSocket*> is(*_sockets);
    527528    while (is.hasNext()) {
    528529      QTcpSocket* sock = is.next();
    529530      if (sock->state() == QAbstractSocket::ConnectedState) {
    530         sock->write(allLines);
     531        int fd = sock->socketDescriptor();
     532        if (::write(fd, allLines.data(), allLines.size()) != allLines.size()) {
     533          delete sock;
     534          is.remove();
     535        }
     536      }
     537      else if (sock->state() != QAbstractSocket::ConnectingState) {
     538        delete sock;
     539        is.remove();
    531540      }
    532541    }
     
    590599  // ----------------------
    591600  if (_sockets) {
    592     QListIterator<QTcpSocket*> is(*_sockets);
     601    QMutableListIterator<QTcpSocket*> is(*_sockets);
    593602    while (is.hasNext()) {
    594603      QTcpSocket* sock = is.next();
    595604      if (sock->state() == QAbstractSocket::ConnectedState) {
    596         sock->write(allLines);
     605        int fd = sock->socketDescriptor();
     606        if (::write(fd, allLines.data(), allLines.size()) != allLines.size()) {
     607          delete sock;
     608          is.remove();
     609        }
     610      }
     611      else if (sock->state() != QAbstractSocket::ConnectingState) {
     612        delete sock;
     613        is.remove();
    597614      }
    598615    }
Note: See TracChangeset for help on using the changeset viewer.