- Timestamp:
- Sep 13, 2022, 10:11:46 AM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/src/upload/bncrtnetuploadcaster.cpp
r9821 r9823 264 264 QMutexLocker locker(&_mutex); 265 265 266 // Append to internal buffer 266 267 268 269 /* Append to internal buffer 267 270 // ------------------------- 268 271 _rtnetStreamBuffer.append(QByteArray(buffer, bufLen)); … … 304 307 305 308 if (lines.size() < 2) { 309 emit(newMessage( 310 "bncRtnetUploadCaster: less than 2 lines to decode " + _casterID.toLatin1(), false)); 306 311 return; 307 312 } 308 313 */ 314 315 316 // Append to internal buffer 317 // ------------------------- 318 _rtnetStreamBuffer.append(QByteArray(buffer, bufLen)); 319 320 // Select buffer part that contains last epoch 321 // ------------------------------------------- 322 QStringList lines; 323 int iEpoBeg = _rtnetStreamBuffer.lastIndexOf('*'); // begin of last epoch 324 if (iEpoBeg == -1) { 325 _rtnetStreamBuffer.clear(); 326 return; 327 } 328 _rtnetStreamBuffer = _rtnetStreamBuffer.mid(iEpoBeg); 329 330 int iEpoEnd = _rtnetStreamBuffer.lastIndexOf("EOE"); // end of last epoch 331 if (iEpoEnd == -1) { 332 return; 333 } 334 else { 335 lines = _rtnetStreamBuffer.left(iEpoEnd).split('\n', QString::SkipEmptyParts); 336 _rtnetStreamBuffer = _rtnetStreamBuffer.mid(iEpoEnd+3); 337 } 338 339 if (lines.size() < 2) { 340 emit(newMessage( 341 "bncRtnetUploadCaster: less than 2 lines to decode " + _casterID.toLatin1(), false)); 342 return; 343 } 344 345 // Keep the last unfinished line in buffer 346 // --------------------------------------- 347 int iLastEOL = _rtnetStreamBuffer.lastIndexOf('\n'); 348 if (iLastEOL != -1) { 349 _rtnetStreamBuffer = _rtnetStreamBuffer.mid(iLastEOL+1); 350 } 309 351 // Read first line (with epoch time) 310 352 // ---------------------------------
Note:
See TracChangeset
for help on using the changeset viewer.