Merge "Fix broken BufferHubQueueTest.TestRemoveBuffer" into pi-dev
diff --git a/libs/vr/libbufferhub/buffer_hub-test.cpp b/libs/vr/libbufferhub/buffer_hub-test.cpp
index 3ce5c9f..660a200 100644
--- a/libs/vr/libbufferhub/buffer_hub-test.cpp
+++ b/libs/vr/libbufferhub/buffer_hub-test.cpp
@@ -769,9 +769,14 @@
 
   auto s3 = p->CreateConsumer();
   EXPECT_FALSE(s3);
+  // Note that here the expected error code is EOPNOTSUPP as the socket towards
+  // ProducerChannel has been teared down.
   EXPECT_EQ(s3.error(), EOPNOTSUPP);
 
   s3 = c->CreateConsumer();
   EXPECT_FALSE(s3);
-  EXPECT_EQ(s3.error(), EOPNOTSUPP);
+  // Note that here the expected error code is EPIPE returned from
+  // ConsumerChannel::HandleMessage as the socket is still open but the producer
+  // is gone.
+  EXPECT_EQ(s3.error(), EPIPE);
 }
diff --git a/services/vr/bufferhubd/producer_channel.cpp b/services/vr/bufferhubd/producer_channel.cpp
index e141b91..c38c12b 100644
--- a/services/vr/bufferhubd/producer_channel.cpp
+++ b/services/vr/bufferhubd/producer_channel.cpp
@@ -134,7 +134,6 @@
            channel_id(), buffer_id(), buffer_state_->load());
   for (auto consumer : consumer_channels_) {
     consumer->OnProducerClosed();
-    service()->SetChannel(consumer->channel_id(), nullptr);
   }
   Hangup();
 }