revid: initialising ring buffer in different location

This commit is contained in:
Saxon 2019-02-25 16:03:28 +10:30
parent be6e168774
commit b7d1bd17a7
1 changed files with 2 additions and 1 deletions

View File

@ -187,7 +187,6 @@ func (p *packer) Write(frame []byte) (int, error) {
// an error if construction of the new instance was not successful.
func New(c Config, ns *netsender.Sender) (*Revid, error) {
r := Revid{ns: ns, err: make(chan error)}
r.buffer = ring.NewBuffer(ringBufferSize, ringBufferElementSize, writeTimeout)
r.packer.owner = &r
err := r.reset(c)
if err != nil {
@ -230,6 +229,8 @@ func (r *Revid) reset(config Config) error {
}
r.config = config
r.buffer = ring.NewBuffer(ringBufferSize, ringBufferElementSize, writeTimeout)
for _, dest := range r.destination {
if dest != nil {
err = dest.close()