Skip to content

Commit 12b24fe

Browse files
committed
Return true/false if a waiter was/wasn't notified
The method is used as follows: if notify_response_waiter(response) # Proceed as if a waiter was notified end Previously the return value would be `nil` whenever the loop broke early due to a waiter being found. This meant that the dispatcher thread often believed that a packet was not being handled. As a result the backlog == incomplete sleep kicked in unnecessarily.
1 parent 6509696 commit 12b24fe

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/rex/post/meterpreter/packet_dispatcher.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,15 +455,16 @@ def add_response_waiter(request, completion_routine = nil, completion_param = ni
455455
# if anyone.
456456
#
457457
def notify_response_waiter(response)
458+
handled = false
458459
self.waiters.each() { |waiter|
459460
if (waiter.waiting_for?(response))
460461
waiter.notify(response)
461-
462462
remove_response_waiter(waiter)
463-
463+
handled = true
464464
break
465465
end
466466
}
467+
return handled
467468
end
468469

469470
#

0 commit comments

Comments
 (0)