Skip to content

Commit 0068857

Browse files
authored
Merge pull request rapid7#19718 from sjanusz-r7/add-rpc-token
Keep track of RPC token per-thread
2 parents ebf7379 + 686a463 commit 0068857

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/msf/core/rpc/v10/service.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,16 @@ def process(req)
140140
end
141141
end
142142

143-
::Timeout.timeout(self.dispatcher_timeout) { self.handlers[group].send(mname, *msg) }
143+
::Timeout.timeout(self.dispatcher_timeout) do
144+
Thread.current[:rpc_token] = token
145+
self.handlers[group].send(mname, *msg)
146+
end
144147

145148
rescue ::Exception => e
146149
elog('RPC Exception', error: e)
147150
process_exception(e)
151+
ensure
152+
Thread.current[:rpc_token] = nil
148153
end
149154
end
150155

0 commit comments

Comments
 (0)