Skip to content

Commit

Permalink
added messages batch-submission
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavel Kraynyukhov committed Apr 18, 2018
1 parent 928521f commit 8eea240
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions include/IOWorker.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,31 @@ namespace LAppS
{
mEPoll=ref;
}

void submitResponses(const std::vector<TaggedEvent>& event_batch)
{
SyncLock sync(mConnectionsMutex);
for( auto event : event_batch)
{
auto it=mConnections.find(event.sockfd);
if(it!=mConnections.end())
{
auto current=it->second;
if(current)
{
if((current->getState() == WSType::MESSAGING)&&(current->isValid()))
{
current->enqueueOutMessage(event);
mEvents.push({LAppS::EBUS::OUT,event.sockfd});
}
else
{
mConnections.erase(it);
}
}
}
}
}
void submitResponse(const TaggedEvent& event)
{
SyncLock sync(mConnectionsMutex);
Expand All @@ -180,6 +205,11 @@ namespace LAppS
}
}

void submitError(const int& fd)
{
mEvents.push({LAppS::EBUS::ERROR,fd});
}

private:
itc::utils::Bool2Type<TLSEnable> enableTLS;
itc::utils::Bool2Type<StatsEnable> enableStatsUpdate;
Expand Down

0 comments on commit 8eea240

Please # to comment.