- Timestamp:
- Nov 4, 2010, 5:25:53 PM (14 years ago)
- Location:
- trunk/BNS
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNS/bnscaster.cpp
r2636 r2643 93 93 // Start the Communication with NTRIP Caster 94 94 //////////////////////////////////////////////////////////////////////////// 95 void t_bnscaster::open( ) {95 void t_bnscaster::open(bool force) { 96 96 97 97 if (_mountpoint.isEmpty()) { … … 99 99 } 100 100 101 if (_outSocket != 0 && 102 _outSocket->state() == QAbstractSocket::ConnectedState) { 103 return; 101 if (_outSocket != 0) { 102 if ( _outSocket->state() == QAbstractSocket::HostLookupState || 103 _outSocket->state() == QAbstractSocket::ConnectingState || 104 _outSocket->state() == QAbstractSocket::ConnectedState ) { 105 return; 106 } 104 107 } 105 108 … … 110 113 _sOpenTrial = 4; 111 114 } 112 if (_outSocketOpenTime.isValid() && 115 if (!force && 116 _outSocketOpenTime.isValid() && 113 117 _outSocketOpenTime.secsTo(QDateTime::currentDateTime()) < minDt) { 114 118 return; … … 217 221 //////////////////////////////////////////////////////////////////////////// 218 222 void t_bnscaster::write(char* buffer, unsigned len) { 219 if (_outSocket) { 220 unsigned bytesWritten = _outSocket->write(buffer, len); 221 _outSocket->flush(); 222 if (bytesWritten != len) { 223 emit(newMessage("Broadcaster: cannot write to socket, closing")); 224 delete _outSocket; 225 _outSocket = 0; 223 for (int iTrial = 1; iTrial <= 2; ++iTrial) { 224 if (_outSocket) { 225 unsigned bytesWritten = _outSocket->write(buffer, len); 226 if (bytesWritten == len) { 227 _outSocket->flush(); 228 break; 229 } 230 else { 231 emit(newMessage("Broadcaster: cannot write to socket, closing")); 232 delete _outSocket; 233 _outSocket = 0; 234 open(true); 235 } 226 236 } 227 237 } -
trunk/BNS/bnscaster.h
r2046 r2643 10 10 t_bnscaster(const QString& mountpoint); 11 11 virtual ~t_bnscaster(); 12 void open( );12 void open(bool force = false); 13 13 void write(char* buffer, unsigned len); 14 14 void printAscii(const QString& line);
Note:
See TracChangeset
for help on using the changeset viewer.