File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -307,19 +307,19 @@ class ManyLevelGuest extends AbstractLevel {
307
307
}
308
308
309
309
_close ( cb ) {
310
- if ( this [ kDb ] ) return this [ kDb ] . _close ( cb )
311
-
310
+ // Even if forward() was used, still need to abort requests made before forward().
312
311
this [ kExplicitClose ] = true
313
312
this [ kAbortRequests ] ( 'Aborted on database close()' , 'LEVEL_DATABASE_NOT_OPEN' )
314
313
315
314
if ( this [ kRpcStream ] ) {
316
- // kRpcStream could be a socket and emit 'close' with a
317
- // hadError argument. Ignore that argument.
318
- this [ kRpcStream ] . once ( 'close' , ( ) => {
315
+ eos ( this [ kRpcStream ] , ( ) => {
319
316
this [ kRpcStream ] = null
320
- cb ( )
317
+ this . _close ( cb )
321
318
} )
322
319
this [ kRpcStream ] . destroy ( )
320
+ } else if ( this [ kDb ] ) {
321
+ // To be safe, use close() not _close().
322
+ this [ kDb ] . close ( cb )
323
323
} else {
324
324
this . nextTick ( cb )
325
325
}
You can’t perform that action at this time.
0 commit comments