users@grizzly.java.net

Re: (issue 548) grizzly-sendfile bugs for 1.9.5

From: Igor Minar <iiminar_at_gmail.com>
Date: Sat, 2 May 2009 05:37:59 -0700

thanks to JFA's suggestion I have a patch for the issue. Please review
it and let me know if it can be accepted:

Index: modules/http/src/main/java/com/sun/grizzly/http/
SelectorThreadKeyHandler.java
===================================================================
--- modules/http/src/main/java/com/sun/grizzly/http/
SelectorThreadKeyHandler.java (revision 3122)
+++ modules/http/src/main/java/com/sun/grizzly/http/
SelectorThreadKeyHandler.java (working copy)
@@ -83,6 +83,10 @@

      @Override
      public void doRegisterKey(SelectionKey key, int ops, long
currentTime) {
+ if
(key.attachment().equals(SelectionKeyAttachment.DEREGISTERED)){
+ return; //the key was intentionally deregistered by an
extension
+ }
+
          if (!key.isValid()){
              selectorHandler.addPendingKeyCancel(key);
          }else{
Index: modules/utils/src/main/java/com/sun/grizzly/util/
SelectionKeyAttachment.java
===================================================================
--- modules/utils/src/main/java/com/sun/grizzly/util/
SelectionKeyAttachment.java (revision 3122)
+++ modules/utils/src/main/java/com/sun/grizzly/util/
SelectionKeyAttachment.java (working copy)
@@ -48,6 +48,7 @@
   */
  public abstract class SelectionKeyAttachment {
      public static final long UNLIMITED_TIMEOUT = Long.MIN_VALUE;
+ public static final long DEREGISTERED = Long.MIN_VALUE + 1;

      protected long timeout = UNLIMITED_TIMEOUT;