File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -819,6 +819,8 @@ export class ModernConnection extends TypedEventEmitter<ConnectionEvents> {
819819 /** @event */
820820 static readonly UNPINNED = UNPINNED ;
821821
822+ socketWrite : ( buffer : Uint8Array , options : { signal : AbortSignal } ) => Promise < void > ;
823+
822824 constructor ( stream : Stream , options : ConnectionOptions ) {
823825 super ( ) ;
824826
@@ -839,6 +841,11 @@ export class ModernConnection extends TypedEventEmitter<ConnectionEvents> {
839841 this . socket . on ( 'error' , this . onError . bind ( this ) ) ;
840842 this . socket . on ( 'close' , this . onClose . bind ( this ) ) ;
841843 this . socket . on ( 'timeout' , this . onTimeout . bind ( this ) ) ;
844+
845+ const socketWrite = promisify ( this . socket . write . bind ( this . socket ) ) ;
846+ this . socketWrite = ( buffer , options ) => {
847+ return abortable ( socketWrite ( buffer ) , options ) ;
848+ } ;
842849 }
843850
844851 async commandAsync ( ...args : Parameters < typeof this . command > ) {
@@ -1256,9 +1263,7 @@ export async function writeCommand(
12561263
12571264 const buffer = Buffer . concat ( await finalCommand . toBin ( ) ) ;
12581265
1259- const socketWriteFn = promisify ( connection . socket . write . bind ( connection . socket ) ) ;
1260-
1261- return abortable ( socketWriteFn ( buffer ) , options ) ;
1266+ return connection . socketWrite ( buffer , options ) ;
12621267}
12631268
12641269/**
You can’t perform that action at this time.
0 commit comments