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 {
307307 }
308308
309309 _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().
312311 this [ kExplicitClose ] = true
313312 this [ kAbortRequests ] ( 'Aborted on database close()' , 'LEVEL_DATABASE_NOT_OPEN' )
314313
315314 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 ] , ( ) => {
319316 this [ kRpcStream ] = null
320- cb ( )
317+ this . _close ( cb )
321318 } )
322319 this [ kRpcStream ] . destroy ( )
320+ } else if ( this [ kDb ] ) {
321+ // To be safe, use close() not _close().
322+ this [ kDb ] . close ( cb )
323323 } else {
324324 this . nextTick ( cb )
325325 }
You can’t perform that action at this time.
0 commit comments