subspace icon indicating copy to clipboard operation
subspace copied to clipboard

Creating multiple publishers fails if one resizes the channel before the other is created

Open a7g4 opened this issue 1 year ago • 1 comments

Example test case:

TEST_F(ClientTest, CreatePublisherAutomaticResizeCreateSecondPublisher) {
  subspace::Client pub_client1;
  subspace::Client pub_client2;
  ASSERT_TRUE(pub_client1.Init(Socket()).ok());
  ASSERT_TRUE(pub_client2.Init(Socket()).ok());

  auto pub_client1_pub = *pub_client1.CreatePublisher("Channel5", 256, 8);
  pub_client1_pub.GetMessageBuffer(500);

  auto pub_client2_pub = *pub_client2.CreatePublisher("Channel5", 256, 8); // This fails
}

Is this expected behaviour?

If not, It looks like after removing the slot size check here everything else seems to still work (after updating the BadPublisherParameters test) https://github.com/dallison/subspace/blob/1089b689540e6f3f18b9c6d1609cdc73415bbf29/server/client_handler.cc#L159

a7g4 avatar Feb 06 '24 06:02 a7g4

Yeah, this is a bug. It should probably just check the number of slots, since the slot size can be increased. Thanks for the report. I'll implement a fix.

dallison avatar Feb 08 '24 02:02 dallison