2016-06-14 16:54:23 +00:00
|
|
|
package natpmp
|
|
|
|
|
|
|
|
type callObserver interface {
|
|
|
|
observeCall(msg []byte, result []byte, err error)
|
|
|
|
}
|
|
|
|
|
|
|
|
// A caller that records the RPC call.
|
|
|
|
type recorder struct {
|
|
|
|
child caller
|
|
|
|
observer callObserver
|
|
|
|
}
|
|
|
|
|
2020-02-21 14:48:53 +00:00
|
|
|
func (n *recorder) call(msg []byte) (result []byte, err error) {
|
|
|
|
result, err = n.child.call(msg)
|
2016-06-14 16:54:23 +00:00
|
|
|
n.observer.observeCall(msg, result, err)
|
|
|
|
return
|
|
|
|
}
|