Use a better name.
parent
54b3ccc86a
commit
e6656ea87f
|
@ -53,7 +53,7 @@ type commonOp struct {
|
||||||
|
|
||||||
// A function that is invoked with the error given to Respond, for use in
|
// A function that is invoked with the error given to Respond, for use in
|
||||||
// closing off traces and reporting back to the connection.
|
// closing off traces and reporting back to the connection.
|
||||||
finish func(error)
|
finished func(error)
|
||||||
}
|
}
|
||||||
|
|
||||||
var gPIDMapMu sync.Mutex
|
var gPIDMapMu sync.Mutex
|
||||||
|
@ -156,13 +156,13 @@ func (o *commonOp) init(
|
||||||
op Op,
|
op Op,
|
||||||
bazilReq bazilfuse.Request,
|
bazilReq bazilfuse.Request,
|
||||||
log func(int, string, ...interface{}),
|
log func(int, string, ...interface{}),
|
||||||
finish func(error)) {
|
finished func(error)) {
|
||||||
// Initialize basic fields.
|
// Initialize basic fields.
|
||||||
o.ctx = ctx
|
o.ctx = ctx
|
||||||
o.op = op
|
o.op = op
|
||||||
o.bazilReq = bazilReq
|
o.bazilReq = bazilReq
|
||||||
o.log = log
|
o.log = log
|
||||||
o.finish = finish
|
o.finished = finished
|
||||||
|
|
||||||
// Set up a context that reflects per-PID tracing if appropriate.
|
// Set up a context that reflects per-PID tracing if appropriate.
|
||||||
o.ctx = o.maybeTraceByPID(o.ctx, int(bazilReq.Hdr().Pid))
|
o.ctx = o.maybeTraceByPID(o.ctx, int(bazilReq.Hdr().Pid))
|
||||||
|
@ -172,8 +172,8 @@ func (o *commonOp) init(
|
||||||
o.ctx, reportForTrace = reqtrace.StartSpan(ctx, o.op.ShortDesc())
|
o.ctx, reportForTrace = reqtrace.StartSpan(ctx, o.op.ShortDesc())
|
||||||
|
|
||||||
// When the op is finished, report to both reqtrace and the connection.
|
// When the op is finished, report to both reqtrace and the connection.
|
||||||
prevFinish := o.finish
|
prevFinish := o.finished
|
||||||
o.finish = func(err error) {
|
o.finished = func(err error) {
|
||||||
reportForTrace(err)
|
reportForTrace(err)
|
||||||
prevFinish(err)
|
prevFinish(err)
|
||||||
}
|
}
|
||||||
|
@ -210,7 +210,7 @@ func (o *commonOp) respondErr(err error) {
|
||||||
o.bazilReq.RespondError(err)
|
o.bazilReq.RespondError(err)
|
||||||
|
|
||||||
// Report back to the connection that we are finished.
|
// Report back to the connection that we are finished.
|
||||||
o.finish(err)
|
o.finished(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Respond with the supplied response struct, which must be accepted by a
|
// Respond with the supplied response struct, which must be accepted by a
|
||||||
|
@ -234,5 +234,5 @@ func (o *commonOp) respond(resp interface{}) {
|
||||||
respond.Call([]reflect.Value{reflect.ValueOf(resp)})
|
respond.Call([]reflect.Value{reflect.ValueOf(resp)})
|
||||||
|
|
||||||
// Report back to the connection that we are finished.
|
// Report back to the connection that we are finished.
|
||||||
o.finish(nil)
|
o.finished(nil)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue