- Timestamp:
- Dec 17, 2007, 5:13:44 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/bnccaster.cpp
r636 r637 39 39 * -----------------------------------------------------------------------*/ 40 40 41 #include <iostream> 41 42 #include <math.h> 42 43 #include <unistd.h> … … 266 267 if (_sockets) { 267 268 int numBytes = sizeof(obs->_o); 268 Q ListIterator<QTcpSocket*> is(*_sockets);269 QMutableListIterator<QTcpSocket*> is(*_sockets); 269 270 while (is.hasNext()) { 270 271 QTcpSocket* sock = is.next(); 271 272 if (sock->state() == QAbstractSocket::ConnectedState) { 273 bool ok = true; 272 274 int fd = sock->socketDescriptor(); 273 275 if (first) { 274 ::write(fd, &begEpoch, 1); 275 } 276 ::write(fd, &begObs, 1); 277 ::write(fd, &obs->_o, numBytes); 276 if (::write(fd, &begEpoch, 1) != 1) { 277 ok = false; 278 } 279 } 280 if (::write(fd, &begObs, 1) != 1) { 281 ok = false; 282 } 283 if (::write(fd, &obs->_o, numBytes) != numBytes) { 284 ok = false; 285 } 278 286 if (!it.hasNext()) { 279 ::write(fd, &endEpoch, 1); 280 } 287 if (::write(fd, &endEpoch, 1) != 1) { 288 ok = false; 289 } 290 } 291 if (!ok) { 292 delete sock; 293 is.remove(); 294 } 295 } 296 else if (sock->state() != QAbstractSocket::ConnectingState) { 297 delete sock; 298 is.remove(); 281 299 } 282 300 }
Note:
See TracChangeset
for help on using the changeset viewer.