mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
[fix] jruby hang with TLS due not executing task
basically the use of Java SSL API was incorrect ... and reproduced when verification is enabled - the engine needs to execute a task but the handling code was not reached
This commit is contained in:
parent
acfc0859c4
commit
d1731a5607
1 changed files with 10 additions and 12 deletions
|
@ -355,14 +355,6 @@ public class MiniSSL extends RubyObject { // MiniSSL::Engine
|
|||
}
|
||||
}
|
||||
|
||||
// after each op, run any delegated tasks if needed
|
||||
if(res.getHandshakeStatus() == HandshakeStatus.NEED_TASK) {
|
||||
Runnable runnable;
|
||||
while ((runnable = engine.getDelegatedTask()) != null) {
|
||||
runnable.run();
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -380,11 +372,12 @@ public class MiniSSL extends RubyObject { // MiniSSL::Engine
|
|||
|
||||
HandshakeStatus handshakeStatus = engine.getHandshakeStatus();
|
||||
boolean done = false;
|
||||
SSLEngineResult res = null;
|
||||
while (!done) {
|
||||
SSLEngineResult res;
|
||||
switch (handshakeStatus) {
|
||||
case NEED_WRAP:
|
||||
res = doOp(SSLOperation.WRAP, inboundAppData, outboundNetData);
|
||||
handshakeStatus = res.getHandshakeStatus();
|
||||
break;
|
||||
case NEED_UNWRAP:
|
||||
res = doOp(SSLOperation.UNWRAP, inboundNetData, inboundAppData);
|
||||
|
@ -392,13 +385,18 @@ public class MiniSSL extends RubyObject { // MiniSSL::Engine
|
|||
// need more data before we can shake more hands
|
||||
done = true;
|
||||
}
|
||||
handshakeStatus = res.getHandshakeStatus();
|
||||
break;
|
||||
case NEED_TASK:
|
||||
Runnable runnable;
|
||||
while ((runnable = engine.getDelegatedTask()) != null) {
|
||||
runnable.run();
|
||||
}
|
||||
handshakeStatus = engine.getHandshakeStatus();
|
||||
break;
|
||||
default:
|
||||
done = true;
|
||||
}
|
||||
if (!done) {
|
||||
handshakeStatus = res.getHandshakeStatus();
|
||||
}
|
||||
}
|
||||
|
||||
if (inboundNetData.hasRemaining()) {
|
||||
|
|
Loading…
Reference in a new issue