1
mirror of https://github.com/rapid7/metasploit-payloads synced 2024-12-21 05:35:54 +01:00

Land #38, fix thread race condition

This commit is contained in:
Brent Cook 2015-06-01 08:00:26 -05:00
commit e4af7abf22

View File

@ -68,18 +68,20 @@ public class AndroidMeterpreter extends Meterpreter {
final Handler handler = new Handler(Looper.getMainLooper());
handler.post(new Runnable() {
public void run() {
try {
context = (Context) currentApplication.invoke(null, (Object[]) null);
} catch (Exception e) {
e.printStackTrace();
}
synchronized (contextWaiter) {
try {
context = (Context) currentApplication.invoke(null, (Object[]) null);
} catch (Exception e) {
e.printStackTrace();
}
contextWaiter.notify();
}
}
});
synchronized (contextWaiter) {
contextWaiter.wait();
if (context == null) {
contextWaiter.wait(100);
}
}
}
}