websocket: fix panic() on concurrent writes
websocket: fix panic() on concurrent writes

We were panic()ing sometimes (see below) on current writes. Let's not do
that.

panic: concurrent write to websocket connection

goroutine 429 [running]:
github.com/gorilla/websocket.(*Conn).flushFrame(0x504d5a70, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0)
  /lxd/build/tmp.39Rjv1YQMz/go/src/github.com/gorilla/websocket/conn.go:450 +0x516
github.com/gorilla/websocket.(*Conn).NextWriter(0x504d5a70, 0x8, 0x0, 0x0, 0x0, 0x0)
  /lxd/build/tmp.39Rjv1YQMz/go/src/github.com/gorilla/websocket/conn.go:378 +0x7c
github.com/gorilla/websocket.(*Conn).WriteMessage(0x504d5a70, 0x8, 0x509ac9e0, 0x2, 0x2, 0x0, 0x0)
  /lxd/build/tmp.39Rjv1YQMz/go/src/github.com/gorilla/websocket/conn.go:585 +0x37
main.(*migrationFields).disconnect(0x505755c0)
  /lxd/build/tmp.39Rjv1YQMz/go/src/github.com/lxc/lxd/lxd/migrate.go:93 +0x1ba
main.(*migrationSink).do(0x505755c0, 0x0, 0x0)
  /lxd/build/tmp.39Rjv1YQMz/go/src/github.com/lxc/lxd/lxd/migrate.go:638 +0x6ae
main.(*migrationSink).(main.do)-fm(0x0, 0x0)
  /lxd/build/tmp.39Rjv1YQMz/go/src/github.com/lxc/lxd/lxd/migrate.go:442 +0x2c
main.createFromMigration.func1(0x50890070, 0x0, 0x0)
  /lxd/build/tmp.39Rjv1YQMz/go/src/github.com/lxc/lxd/lxd/containers_post.go:244 +0x3e3
main.(*operation).Run.func1(0x50890070, 0x50650300)
  /lxd/build/tmp.39Rjv1YQMz/go/src/github.com/lxc/lxd/lxd/operations.go:110 +0x31
created by main.(*operation).Run
  /lxd/build/tmp.39Rjv1YQMz/go/src/github.com/lxc/lxd/lxd/operations.go:135 +0xe2

Signed-off-by: Tycho Andersen <10c18fcb898ee6b17d6575d444b125d10b3f4d6a@canonical.com>

stgraber/lxd,erikmack/lxd,yura-pakhuchiy/lxd,hallyn/lxd,ollie314/lxd,lxc/lxd,hallyn/lxd,lxc/lxd,mjeanson/lxd,pcdummy/lxd,akshaykarle/lxd,lxc/lxd,Skarlso/lxd,erikmack/lxd,Skarlso/lxd,hallyn/lxd,jsavikko/lxd,akshaykarle/lxd,atxwebs/lxd,mjeanson/lxd,hallyn/lxd,Skarlso/lxd,lxc/lxd,techtonik/lxd,yura-pakhuchiy/lxd,atxwebs/lxd,Skarlso/lxd,stgraber/lxd,lxc/lxd,pcdummy/lxd,ollie314/lxd,jsavikko/lxd,lxc/lxd,akshaykarle/lxd,hallyn/lxd,yura-pakhuchiy/lxd,techtonik/lxd,lxc/lxd,chrisglass/lxd,stgraber/lxd,stgraber/lxd,atxwebs/lxd,chrisglass/lxd,stgraber/lxd,jsavikko/lxd,georghopp/lxd,ollie314/lxd,georghopp/lxd,georghopp/lxd,atxwebs/lxd,mjeanson/lxd,erikmack/lxd,pcdummy/lxd,chrisglass/lxd,stgraber/lxd,techtonik/lxd,stgraber/lxd,hallyn/lxd