Skip to content

Instantly share code, notes, and snippets.

@j0sh
Created May 10, 2012 23:49
Show Gist options
  • Select an option

  • Save j0sh/2656634 to your computer and use it in GitHub Desktop.

Select an option

Save j0sh/2656634 to your computer and use it in GitHub Desktop.
Don't double-enqueue packets for delete.
commit 0d6fe2f32bcece6ecacfabfc894846a9a3d2f262
Author: Josh Allmann <joshua.allmann@gmail.com>
Date: Thu May 10 16:40:03 2012 -0700
-- Don't double-enqueue packets for delete.
This may lead to an infinite loop in some cases,
especially with dependent protocols that are not chained.
diff --git a/sources/thelib/src/protocols/baseprotocol.cpp b/sources/thelib/src/protocols/baseprotocol.cpp
index 3b08a48..2a2771d 100644
--- a/sources/thelib/src/protocols/baseprotocol.cpp
+++ b/sources/thelib/src/protocols/baseprotocol.cpp
@@ -199,6 +199,7 @@ BaseProtocol *BaseProtocol::GetNearEndpoint() {
}
void BaseProtocol::EnqueueForDelete() {
+ if (_enqueueForDelete) return;
_enqueueForDelete = true;
ProtocolManager::EnqueueForDelete(this);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment