diff --git a/event/eventQueue.go b/event/eventQueue.go index 8871ada..6d1919c 100644 --- a/event/eventQueue.go +++ b/event/eventQueue.go @@ -48,8 +48,10 @@ func (iq *queue) Len() int { // Shutdown closes our eventChannel func (iq *queue) Shutdown() { iq.lock.Lock() - iq.closed = true - iq.infChan.Close() + if !iq.closed { + iq.closed = true + iq.infChan.Close() + } iq.lock.Unlock() } diff --git a/peer/cwtch_peer.go b/peer/cwtch_peer.go index 9bb3dc8..3d7ed6c 100644 --- a/peer/cwtch_peer.go +++ b/peer/cwtch_peer.go @@ -1124,10 +1124,13 @@ func (cp *cwtchPeer) StartServerConnections() { func (cp *cwtchPeer) Shutdown() { cp.mutex.Lock() defer cp.mutex.Unlock() - cp.shutdown = true - cp.queue.Shutdown() - if cp.storage != nil { - cp.storage.Close(true) + // don't allow this to be shutdown twice... + if !cp.shutdown { + cp.shutdown = true + cp.queue.Shutdown() + if cp.storage != nil { + cp.storage.Close(true) + } } } diff --git a/testing/filesharing/file_sharing_integration_test.go b/testing/filesharing/file_sharing_integration_test.go index 2539011..e3006dd 100644 --- a/testing/filesharing/file_sharing_integration_test.go +++ b/testing/filesharing/file_sharing_integration_test.go @@ -157,6 +157,9 @@ func TestFileSharing(t *testing.T) { // run the same download test again...to check that we can actually download the file testBobDownloadFile(t, bob, filesharingFunctionality, queueOracle) + // test that we can delete bob... + app.DeletePeer(bob.GetOnion(), "asdfasdf") + queueOracle.Shutdown() app.Shutdown() acn.Close()