Removed synchronization from Connection.Close.

geesefs-0-30-9
Aaron Jacobs 2015-06-09 11:02:08 +10:00
parent 5ae9856c29
commit 6c85a93914
1 changed files with 2 additions and 9 deletions

View File

@ -43,7 +43,6 @@ type Connection struct {
debugLogger *log.Logger debugLogger *log.Logger
errorLogger *log.Logger errorLogger *log.Logger
wrapped *bazilfuse.Conn wrapped *bazilfuse.Conn
opsInFlight sync.WaitGroup
// The context from which all op contexts inherit. // The context from which all op contexts inherit.
parentCtx context.Context parentCtx context.Context
@ -217,9 +216,6 @@ func (c *Connection) beginOp(
bfReq bazilfuse.Request) (ctx context.Context) { bfReq bazilfuse.Request) (ctx context.Context) {
reqID := bfReq.Hdr().ID reqID := bfReq.Hdr().ID
// Note that the op is in flight.
c.opsInFlight.Add(1)
// Choose a parent context. // Choose a parent context.
ctx = c.maybeTraceByPID(int(bfReq.Hdr().Pid)) ctx = c.maybeTraceByPID(int(bfReq.Hdr().Pid))
@ -267,9 +263,6 @@ func (c *Connection) finishOp(bfReq bazilfuse.Request) {
cancel() cancel()
delete(c.cancelFuncs, reqID) delete(c.cancelFuncs, reqID)
} }
// Decrement the in-flight counter.
c.opsInFlight.Done()
} }
// LOCKS_EXCLUDED(c.mu) // LOCKS_EXCLUDED(c.mu)
@ -365,9 +358,9 @@ func (c *Connection) waitForReady() (err error) {
return return
} }
// Close the connection and wait for in-flight ops. // Close the connection. Must not be called until operations that were read
// from the connection have been responded to.
func (c *Connection) close() (err error) { func (c *Connection) close() (err error) {
err = c.wrapped.Close() err = c.wrapped.Close()
c.opsInFlight.Wait()
return return
} }