Initial integration of new topicTree
This commit is contained in:
+2
-2
@@ -76,13 +76,13 @@ struct Intersection {
|
||||
std::pair<std::string, std::string> dataChannels;
|
||||
std::vector<Hole> holes;
|
||||
|
||||
void forSubscriber(Subscriber *s, std::vector<unsigned int> &senderForMessages, std::function<void(std::pair<std::string_view, std::string_view>)> cb) {
|
||||
void forSubscriber(std::vector<unsigned int> &senderForMessages, std::function<void(std::pair<std::string_view, std::string_view>)> cb) {
|
||||
/* How far we already emitted of the two dataChannels */
|
||||
std::pair<size_t, size_t> emitted = {};
|
||||
|
||||
/* Holes are global to the entire topic tree, so we are not guaranteed to find
|
||||
* holes in this intersection - they are sorted, though */
|
||||
int examinedHoles = 0;
|
||||
unsigned int examinedHoles = 0;
|
||||
|
||||
/* This is a slow path of sorts, most subscribers will be observers, not active senders */
|
||||
for (unsigned int id : senderForMessages) {
|
||||
|
||||
@@ -76,7 +76,13 @@ public:
|
||||
Loop::get()->removePreHandler(this);
|
||||
}
|
||||
|
||||
WebSocketContextData() : topicTree([this](Subscriber *s, std::pair<std::string_view, std::string_view> data) -> int {
|
||||
WebSocketContextData() : topicTree([this](Subscriber *s, Intersection &intersection) -> int {
|
||||
|
||||
|
||||
std::pair<std::string_view, std::string_view> data = intersection.dataChannels;
|
||||
|
||||
|
||||
|
||||
/* We rely on writing to regular asyncSockets */
|
||||
auto *asyncSocket = (AsyncSocket<SSL> *) s->user;
|
||||
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ void testCorrectness() {
|
||||
|
||||
topicTree = new uWS::TopicTree([&topicTree, &actualResult](uWS::Subscriber *s, uWS::Intersection &intersection) {
|
||||
|
||||
intersection.forSubscriber(s, topicTree->getSenderFor(s), [s, &actualResult](std::pair<std::string_view, std::string_view> dataChannels) {
|
||||
intersection.forSubscriber(topicTree->getSenderFor(s), [s, &actualResult](std::pair<std::string_view, std::string_view> dataChannels) {
|
||||
actualResult[s].first += dataChannels.first;
|
||||
actualResult[s].second += dataChannels.second;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user