]> WPIA git - gigi.git/blobdiff - lib/jetty/org/eclipse/jetty/server/HttpChannelState.java
updating jetty to jetty-9.2.16.v2016040
[gigi.git] / lib / jetty / org / eclipse / jetty / server / HttpChannelState.java
index 7ff4d5a2a47a4ed49c0f4805b4552b52c0da0c0e..c0cfa2f06b477e1b1334d0c07732b64b0ec45405 100644 (file)
@@ -1,6 +1,6 @@
 //
 //  ========================================================================
 //
 //  ========================================================================
-//  Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
+//  Copyright (c) 1995-2016 Mort Bay Consulting Pty. Ltd.
 //  ------------------------------------------------------------------------
 //  All rights reserved. This program and the accompanying materials
 //  are made available under the terms of the Eclipse Public License v1.0
 //  ------------------------------------------------------------------------
 //  All rights reserved. This program and the accompanying materials
 //  are made available under the terms of the Eclipse Public License v1.0
@@ -40,7 +40,7 @@ public class HttpChannelState
 {
     private static final Logger LOG = Log.getLogger(HttpChannelState.class);
 
 {
     private static final Logger LOG = Log.getLogger(HttpChannelState.class);
 
-    private final static long DEFAULT_TIMEOUT=30000L;
+    private final static long DEFAULT_TIMEOUT=Long.getLong("org.eclipse.jetty.server.HttpChannelState.DEFAULT_TIMEOUT",30000L);
 
     /** The dispatched state of the HttpChannel, used to control the overall livecycle
      */
 
     /** The dispatched state of the HttpChannel, used to control the overall livecycle
      */
@@ -52,7 +52,8 @@ public class HttpChannelState
         ASYNC_WOKEN,      // A thread has been dispatch to handle from ASYNCWAIT
         ASYNC_IO,         // Has been dispatched for async IO
         COMPLETING,       // Request is completable
         ASYNC_WOKEN,      // A thread has been dispatch to handle from ASYNCWAIT
         ASYNC_IO,         // Has been dispatched for async IO
         COMPLETING,       // Request is completable
-        COMPLETED         // Request is complete
+        COMPLETED,        // Request is complete
+        UPGRADED          // Request upgraded the connection
     }
 
     /**
     }
 
     /**
@@ -525,6 +526,8 @@ public class HttpChannelState
                 case DISPATCHED:
                 case ASYNC_IO:
                     throw new IllegalStateException(getStatusString());
                 case DISPATCHED:
                 case ASYNC_IO:
                     throw new IllegalStateException(getStatusString());
+                case UPGRADED:
+                    return;
                 default:
                     break;
             }
                 default:
                     break;
             }
@@ -539,6 +542,31 @@ public class HttpChannelState
             _event=null;
         }
     }
             _event=null;
         }
     }
+    
+    public void upgrade()
+    {
+        synchronized (this)
+        {
+            switch(_state)
+            {
+                case IDLE:
+                case COMPLETED:
+                    break;
+                default:
+                    throw new IllegalStateException(getStatusString());
+            }
+            _asyncListeners=null;
+            _state=State.UPGRADED;
+            _async=null;
+            _initial=true;
+            _asyncRead=false;
+            _asyncWrite=false;
+            _timeoutMs=DEFAULT_TIMEOUT;
+            cancelTimeout();
+            _event=null;
+        }
+    }
+
 
     protected void scheduleDispatch()
     {
 
     protected void scheduleDispatch()
     {