@@ -471,8 +471,8 @@ else if ((operations & SelectionKey.OP_WRITE) != 0) {
471
471
writeWouldBlock (runtime , exception , result );
472
472
}
473
473
}
474
- }
475
- catch ( IOException ioe ) {
474
+ } catch ( IOException ioe ) {
475
+ debugStackTrace ( runtime , "SSLSocket.waitSelect" , ioe );
476
476
throw runtime .newRuntimeError ("Error with selector: " + ioe .getMessage ());
477
477
}
478
478
} else {
@@ -483,6 +483,7 @@ public void run() throws InterruptedException {
483
483
result [0 ] = selector .select ();
484
484
}
485
485
catch (IOException ioe ) {
486
+ debugStackTrace (runtime , "SSLSocket.waitSelect" , ioe );
486
487
throw runtime .newRuntimeError ("Error with selector: " + ioe .getMessage ());
487
488
}
488
489
}
@@ -505,32 +506,27 @@ public void wakeup() {
505
506
//JRuby <= 9.1.2.0 that makes this not always the case, so we have to check
506
507
return selector .selectedKeys ().contains (key ) ? Boolean .TRUE : Boolean .FALSE ;
507
508
}
508
- }
509
- catch (InterruptedException interrupt ) { return Boolean .FALSE ; }
510
- finally {
511
- // Note: I don't like ignoring these exceptions, but it's
512
- // unclear how likely they are to happen or what damage we
513
- // might do by ignoring them. Note that the pieces are separate
514
- // so that we can ensure one failing does not affect the others
515
- // running.
509
+ } catch (InterruptedException interrupt ) {
510
+ debug (runtime , "SSLSocket.waitSelect" , interrupt );
511
+ return Boolean .FALSE ;
512
+ } finally {
513
+ // Note: I don't like ignoring these exceptions, but it's unclear how likely they are to happen or what
514
+ // damage we might do by ignoring them. Note that the pieces are separate so that we can ensure one failing
515
+ // does not affect the others running.
516
516
517
517
// clean up the key in the selector
518
518
try {
519
519
if ( key != null ) key .cancel ();
520
520
if ( selector != null ) selector .selectNow ();
521
- }
522
- catch (Exception e ) { // ignore
523
- debugStackTrace (runtime , e );
521
+ } catch (Exception e ) { // ignore
522
+ debugStackTrace (runtime , "SSLSocket.waitSelect (ignored)" , e );
524
523
}
525
524
526
525
// shut down and null out the selector
527
526
try {
528
- if ( selector != null ) {
529
- runtime .getSelectorPool ().put (selector );
530
- }
531
- }
532
- catch (Exception e ) { // ignore
533
- debugStackTrace (runtime , e );
527
+ if ( selector != null ) runtime .getSelectorPool ().put (selector );
528
+ } catch (Exception e ) { // ignore
529
+ debugStackTrace (runtime , "SSLSocket.waitSelect (ignored)" , e );
534
530
}
535
531
536
532
if (blocking ) {
@@ -810,8 +806,11 @@ private void doShutdown() throws IOException {
810
806
flushData (true );
811
807
}
812
808
813
- private IRubyObject sysreadImpl (final ThreadContext context ,
814
- IRubyObject len , IRubyObject buff , final boolean blocking , final boolean exception ) {
809
+ /**
810
+ * @return the (@link RubyString} buffer or :wait_readable / :wait_writeable {@link RubySymbol}
811
+ */
812
+ private IRubyObject sysreadImpl (final ThreadContext context , final IRubyObject len , final IRubyObject buff ,
813
+ final boolean blocking , final boolean exception ) {
815
814
final Ruby runtime = context .runtime ;
816
815
817
816
final int length = RubyNumeric .fix2int (len );
0 commit comments