@@ -376,8 +376,9 @@ class Response {
376376 if ( ! this . complete ( ) ) {
377377 // check if out of space
378378 if ( this . buff . length - this . offset < data . length ) {
379- const bytes = this . expand ( MAPI_BLOCK_SIZE ) ;
380- console . log ( `expanding by ${ bytes } bytes!` ) ;
379+ const nsize = ( data . length + MAPI_BLOCK_SIZE ) & ~ MAPI_BLOCK_SIZE ;
380+ const bytes = this . expand ( nsize ) ;
381+ //console.log(`expanding by ${bytes} bytes!`);
381382 }
382383
383384 if ( segment === undefined || ( segment && segment . isFull ( ) ) ) {
@@ -473,7 +474,7 @@ class Response {
473474 this . offset -= offset ;
474475 }
475476 }
476- const buff = Buffer . allocUnsafe ( this . buff . length + byteCount ) . fill ( 0 ) ;
477+ const buff = Buffer . allocUnsafe ( this . buff . length + byteCount ) ;
477478 const bytesCopied = this . buff . copy ( buff ) ;
478479 this . buff = buff ;
479480 // should be byteCount
@@ -716,7 +717,7 @@ class MapiConnection extends EventEmitter {
716717 socket . addListener ( "error" , this . handleSocketError . bind ( this ) ) ;
717718 socket . addListener ( "timeout" , this . handleTimeout . bind ( this ) ) ;
718719 socket . addListener ( "close" , ( ) => {
719- console . log ( "socket close event" ) ;
720+ // console.log("socket close event");
720721 this . emit ( "end" ) ;
721722 } ) ;
722723 return socket ;
@@ -916,8 +917,8 @@ class MapiConnection extends EventEmitter {
916917 if ( resp . complete ( ) ) this . handleResponse ( resp ) ;
917918 bytesLeftOver = data . length - offset ;
918919 if ( bytesLeftOver ) {
919- const msg = `some ${ bytesLeftOver } bytes left over!` ;
920- console . warn ( msg ) ;
920+ // const msg = `some ${bytesLeftOver} bytes left over!`;
921+ // console.warn(msg);
921922 this . recv ( data . subarray ( offset ) ) ;
922923 }
923924 }
@@ -939,7 +940,7 @@ class MapiConnection extends EventEmitter {
939940 return ;
940941 }
941942 if ( resp . isPrompt ( ) ) {
942- console . log ( "login OK" ) ;
943+ // console.log("login OK");
943944 this . state = MAPI_STATE . READY ;
944945 this . emit ( "ready" , this . state ) ;
945946 return ;
@@ -948,7 +949,7 @@ class MapiConnection extends EventEmitter {
948949 }
949950
950951 if ( resp . isFileTransfer ( ) ) {
951- console . log ( "file transfer" ) ;
952+ // console.log("file transfer");
952953 let fhandler : any ;
953954 const msg = resp . toString ( MSG_FILETRANS . length ) . trim ( ) ;
954955 let mode : string , offset : string , file : string ;
0 commit comments