Skip to content

Commit

Permalink
Adding an optional loop function to the server call
Browse files Browse the repository at this point in the history
  • Loading branch information
madhephaestus committed Jul 27, 2019
1 parent 0b5c88e commit b5c552e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/PacketEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@
PacketEventAbstract::PacketEventAbstract(uint32_t id) {
myId = id;
}
uint32_t PacketEventAbstract::getId() {
return myId;
}
4 changes: 1 addition & 3 deletions src/PacketEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ class PacketEventAbstract {
*/
virtual bool loop(){return false;}

uint32_t getId() {
return myId;
}
uint32_t getId();
};

#endif /* end of include guard: PacketEvent */
1 change: 1 addition & 0 deletions src/SimplePacketComs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ void SimplePacketComsAbstract::server() {
fmap.begin(); it != fmap.end(); ++it) {
if (it->second->getId() == currentId) {
it->second->noResponse = false; // reset the response flag
it->second->loop();
it->second->event(getDataPointer());

if (it->second->noResponse == false) {
Expand Down

0 comments on commit b5c552e

Please sign in to comment.