Changeset 24917 in vbox for trunk/src/VBox/Main
- Timestamp:
- Nov 24, 2009 3:45:00 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/ConsoleImplTeleporter.cpp
r24899 r24917 148 148 uint32_t u32Magic; 149 149 /** The size of the data block following this header. 150 * 0 indicates the end of the stream. */ 150 * 0 indicates the end of the stream, while UINT32_MAX indicates 151 * cancelation. */ 151 152 uint32_t cb; 152 153 } TELEPORTERTCPHDR; … … 388 389 return rc; 389 390 } 390 if ( Hdr.u32Magic != TELEPORTERTCPHDR_MAGIC 391 || Hdr.cb > TELEPORTERTCPHDR_MAX_SIZE) 392 { 391 392 if (RT_UNLIKELY( Hdr.u32Magic != TELEPORTERTCPHDR_MAGIC 393 || Hdr.cb > TELEPORTERTCPHDR_MAX_SIZE 394 || Hdr.cb == 0)) 395 { 396 if ( Hdr.u32Magic == TELEPORTERTCPHDR_MAGIC 397 && ( Hdr.cb == 0 398 || Hdr.cb == UINT32_MAX) 399 ) 400 { 401 pState->mfEndOfStream = true; 402 pState->mcbReadBlock = 0; 403 return Hdr.cb ? VERR_SSM_CANCELLED : VERR_EOF; 404 } 393 405 pState->mfIOError = true; 394 406 LogRel(("Teleporter/TCP: Invalid block: u32Magic=%#x cb=%#x\n", Hdr.u32Magic, Hdr.cb)); … … 397 409 398 410 pState->mcbReadBlock = Hdr.cb; 399 if (!Hdr.cb)400 {401 pState->mfEndOfStream = true;402 return VERR_EOF;403 }404 405 411 if (pState->mfStopReading) 406 412 return VERR_EOF; … … 499 505 * @copydoc SSMSTRMOPS::pfnClose 500 506 */ 501 static DECLCALLBACK(int) teleporterTcpOpClose(void *pvUser )507 static DECLCALLBACK(int) teleporterTcpOpClose(void *pvUser, bool fCancelled) 502 508 { 503 509 TeleporterState *pState = (TeleporterState *)pvUser; … … 505 511 if (pState->mfIsSource) 506 512 { 507 TELEPORTERTCPHDR EofHdr = { TELEPORTERTCPHDR_MAGIC, 0 }; 513 TELEPORTERTCPHDR EofHdr; 514 EofHdr.u32Magic = TELEPORTERTCPHDR_MAGIC; 515 EofHdr.cb = fCancelled ? UINT32_MAX : 0; 508 516 int rc = RTTcpWrite(pState->mhSocket, &EofHdr, sizeof(EofHdr)); 509 517 if (RT_SUCCESS(rc))
Note:
See TracChangeset
for help on using the changeset viewer.