File tree 1 file changed +12
-5
lines changed
1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ export class Pipe {
49
49
this . buf = new Buffer ( 0 ) ;
50
50
else
51
51
this . buf = this . buf . slice ( off + n ) ;
52
+ releaseWriter ( ) ;
52
53
return cb ( undefined , n ) ;
53
54
}
54
55
// at this point, we're waiting on more data or an EOF.
@@ -58,12 +59,8 @@ export class Pipe {
58
59
this . buf = new Buffer ( 0 ) ;
59
60
else
60
61
this . buf = this . buf . slice ( off + n ) ;
62
+ releaseWriter ( ) ;
61
63
cb ( undefined , n ) ;
62
- if ( this . writeWaiter ) {
63
- let waiter = this . writeWaiter ;
64
- this . writeWaiter = undefined ;
65
- waiter ( ) ;
66
- }
67
64
} ;
68
65
}
69
66
@@ -88,6 +85,16 @@ export class Pipe {
88
85
this . readWaiter ( ) ;
89
86
this . readWaiter = undefined ;
90
87
}
88
+
89
+ // if any writers are blocked (because the buffer was at
90
+ // capacity) unblock them
91
+ private releaseWriter ( ) : void {
92
+ if ( this . writeWaiter ) {
93
+ let waiter = this . writeWaiter ;
94
+ this . writeWaiter = undefined ;
95
+ waiter ( ) ;
96
+ }
97
+ }
91
98
}
92
99
93
100
export function isPipe ( f : IFile ) : f is PipeFile {
You can’t perform that action at this time.
0 commit comments