Skip to content

Commit

Permalink
Revert usage of absl ordered set since it sorts... by string!!!
Browse files Browse the repository at this point in the history
  • Loading branch information
ibc committed Dec 12, 2023
1 parent 2328829 commit 1592bbf
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
4 changes: 2 additions & 2 deletions node/src/tests/test-DataConsumer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ test('transport.consumeData() succeeds', async () =>
expect(dataConsumer1.label).toBe('foo');
expect(dataConsumer1.protocol).toBe('bar');
expect(dataConsumer1.paused).toBe(false);
expect(dataConsumer1.subchannels).toEqual([ 0, 1, 2, 100, 65535 ]);
expect(dataConsumer1.subchannels.sort()).toEqual([ 0, 1, 2, 100, 65535 ]);
expect(dataConsumer1.appData).toEqual({ baz: 'LOL' });

const dump = await router.dump();
Expand Down Expand Up @@ -134,7 +134,7 @@ test('dataConsumer.setSubchannels() succeeds', async () =>
{
await dataConsumer1.setSubchannels([ 999, 999, 998, 65536 ]);

expect(dataConsumer1.subchannels).toEqual([ 0, 998, 999 ]);
expect(dataConsumer1.subchannels.sort()).toEqual([ 0, 998, 999 ]);
}, 2000);

test('transport.consumeData() on a DirectTransport succeeds', async () =>
Expand Down
15 changes: 10 additions & 5 deletions rust/tests/integration/data_consumer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,11 @@ fn consume_data_succeeds() {
}
assert_eq!(data_consumer.label().as_str(), "foo");
assert_eq!(data_consumer.protocol().as_str(), "bar");
assert_eq!(data_consumer.subchannels(), [0, 1, 2, 100, 65535]);

let mut sorted_subchannels = data_consumer.subchannels();
sorted_subchannels.sort();

assert_eq!(sorted_subchannels, [0, 1, 2, 100, 65535]);
assert_eq!(
data_consumer
.app_data()
Expand Down Expand Up @@ -324,12 +328,10 @@ fn set_subchannels() {

let data_consumer = transport1
.consume_data({
let options = DataConsumerOptions::new_sctp_unordered_with_life_time(
DataConsumerOptions::new_sctp_unordered_with_life_time(
data_producer.id(),
4000,
);

options
})
.await
.expect("Failed to consume data");
Expand All @@ -339,7 +341,10 @@ fn set_subchannels() {
.await
.expect("Failed to set data consumer subchannels");

assert_eq!(data_consumer.subchannels(), [0, 998, 999]);
let mut sorted_subchannels = data_consumer.subchannels();
sorted_subchannels.sort();

assert_eq!(sorted_subchannels, [0, 998, 999]);
});
}

Expand Down
4 changes: 2 additions & 2 deletions worker/include/RTC/DataConsumer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "Channel/ChannelSocket.hpp"
#include "RTC/SctpDictionaries.hpp"
#include "RTC/Shared.hpp"
#include <absl/container/btree_set.h>
#include <absl/container/flat_hash_set.h>
#include <string>

namespace RTC
Expand Down Expand Up @@ -126,7 +126,7 @@ namespace RTC
RTC::SctpStreamParameters sctpStreamParameters;
std::string label;
std::string protocol;
absl::btree_set<uint16_t> subchannels;
absl::flat_hash_set<uint16_t> subchannels;
bool transportConnected{ false };
bool sctpAssociationConnected{ false };
bool paused{ false };
Expand Down

0 comments on commit 1592bbf

Please sign in to comment.