@@ -9,12 +9,10 @@ class TrailingChecksumTransform extends Transform {
99 /**
1010 * @constructor
1111 * @param {object } log - logger object
12- * @param {function } errCb - callback called if an error occurs
1312 */
14- constructor ( log , errCb ) {
13+ constructor ( log ) {
1514 super ( { } ) ;
1615 this . log = log ;
17- this . errCb = errCb ;
1816 this . chunkSizeBuffer = Buffer . alloc ( 0 ) ;
1917 this . bytesToDiscard = 0 ; // when trailing \r\n are present, we discard them but they can be in different chunks
2018 this . bytesToRead = 0 ; // when a chunk is advertised, the size is put here and we forward all bytes
@@ -53,7 +51,7 @@ class TrailingChecksumTransform extends Transform {
5351 const lineBreakIndex = chunk . indexOf ( '\r' ) ;
5452 if ( lineBreakIndex === - 1 ) {
5553 if ( this . chunkSizeBuffer . byteLength + chunk . byteLength > 10 ) {
56- this . log . info ( 'chunk size field too big' , {
54+ this . log . error ( 'chunk size field too big' , {
5755 chunkSizeBuffer : this . chunkSizeBuffer . toString ( ) ,
5856 truncatedChunk : chunk . subarray ( 0 , 16 ) . toString ( ) ,
5957 } ) ;
@@ -71,7 +69,7 @@ class TrailingChecksumTransform extends Transform {
7169
7270 // chunk-size is sent in hex
7371 if ( ! / ^ [ 0 - 9 a - f A - F ] + $ / . test ( this . chunkSizeBuffer . toString ( ) ) ) {
74- this . log . info ( 'chunk size is not a valid hex number' , {
72+ this . log . error ( 'chunk size is not a valid hex number' , {
7573 chunkSizeBuffer : this . chunkSizeBuffer . toString ( ) ,
7674 } ) ;
7775 return callback ( errors . InvalidArgument ) ;
@@ -85,7 +83,7 @@ class TrailingChecksumTransform extends Transform {
8583 }
8684 this . chunkSizeBuffer = Buffer . alloc ( 0 ) ;
8785 if ( dataSize === 0 ) {
88- // TODO: check if the checksum is correct
86+ // TODO: check if the checksum is correct (S3C-9732)
8987 // last chunk, no more data to read, the stream is closed
9088 this . streamClosed = true ;
9189 }
0 commit comments