@@ -319,27 +319,30 @@ private boolean waitSelect(final int operations, final boolean blocking) throws
319
319
thread .executeBlockingTask (new RubyThread .BlockingTask () {
320
320
public void run () throws InterruptedException {
321
321
try {
322
- if (! blocking ) {
322
+ if ( ! blocking ) {
323
323
result [0 ] = selector .selectNow ();
324
- if (result [0 ] == 0 ) {
324
+
325
+ if ( result [0 ] == 0 ) {
325
326
if ((operations & SelectionKey .OP_READ ) != 0 && (operations & SelectionKey .OP_WRITE ) != 0 ) {
326
- if (key .isReadable ()) {
327
- writeWouldBlock ();
328
- } else if (key .isWritable ()) {
329
- readWouldBlock ();
327
+ if ( key .isReadable () ) {
328
+ writeWouldBlock (runtime );
329
+ } else if ( key .isWritable () ) {
330
+ readWouldBlock (runtime );
330
331
} else { //neither, pick one
331
- readWouldBlock ();
332
+ readWouldBlock (runtime );
332
333
}
333
334
} else if ((operations & SelectionKey .OP_READ ) != 0 ) {
334
- readWouldBlock ();
335
+ readWouldBlock (runtime );
335
336
} else if ((operations & SelectionKey .OP_WRITE ) != 0 ) {
336
- writeWouldBlock ();
337
+ writeWouldBlock (runtime );
337
338
}
338
339
}
339
- } else {
340
+ }
341
+ else {
340
342
result [0 ] = selector .select ();
341
343
}
342
- } catch (IOException ioe ) {
344
+ }
345
+ catch (IOException ioe ) {
343
346
throw runtime .newRuntimeError ("Error with selector: " + ioe .getMessage ());
344
347
}
345
348
}
@@ -349,10 +352,9 @@ public void wakeup() {
349
352
}
350
353
});
351
354
352
- if (result [0 ] >= 1 ) {
355
+ if ( result [0 ] >= 1 ) {
353
356
Set <SelectionKey > keySet = selector .selectedKeys ();
354
-
355
- if (keySet .iterator ().next () == key ) {
357
+ if ( keySet .iterator ().next () == key ) {
356
358
return true ;
357
359
}
358
360
}
@@ -396,12 +398,12 @@ public void wakeup() {
396
398
}
397
399
}
398
400
399
- private void readWouldBlock () {
400
- throw newSSLErrorWaitReadable (getRuntime () , "read would block" );
401
+ private static void readWouldBlock (final Ruby runtime ) {
402
+ throw newSSLErrorWaitReadable (runtime , "read would block" );
401
403
}
402
404
403
- private void writeWouldBlock () {
404
- throw newSSLErrorWaitWritable (getRuntime () , "write would block" );
405
+ private static void writeWouldBlock (final Ruby runtime ) {
406
+ throw newSSLErrorWaitWritable (runtime , "write would block" );
405
407
}
406
408
407
409
private void doHandshake (boolean blocking ) throws IOException {
0 commit comments