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> {
819
819
/** @event */
820
820
static readonly UNPINNED = UNPINNED ;
821
821
822
+ socketWrite : ( buffer : Uint8Array , options : { signal : AbortSignal } ) => Promise < void > ;
823
+
822
824
constructor ( stream : Stream , options : ConnectionOptions ) {
823
825
super ( ) ;
824
826
@@ -839,6 +841,11 @@ export class ModernConnection extends TypedEventEmitter<ConnectionEvents> {
839
841
this . socket . on ( 'error' , this . onError . bind ( this ) ) ;
840
842
this . socket . on ( 'close' , this . onClose . bind ( this ) ) ;
841
843
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
+ } ;
842
849
}
843
850
844
851
async commandAsync ( ...args : Parameters < typeof this . command > ) {
@@ -1256,9 +1263,7 @@ export async function writeCommand(
1256
1263
1257
1264
const buffer = Buffer . concat ( await finalCommand . toBin ( ) ) ;
1258
1265
1259
- const socketWriteFn = promisify ( connection . socket . write . bind ( connection . socket ) ) ;
1260
-
1261
- return abortable ( socketWriteFn ( buffer ) , options ) ;
1266
+ return connection . socketWrite ( buffer , options ) ;
1262
1267
}
1263
1268
1264
1269
/**
You can’t perform that action at this time.
0 commit comments