Permalink
Browse files

set so opts

  • Loading branch information...
1 parent d33f5e1 commit a8cdc94c3d7f76ab80c5e5fdb55ef6516684cace @grze grze committed Aug 6, 2009
View
1 clc/modules/wsstack/src/main/java/com/eucalyptus/ws/server/NioServer.java
@@ -22,6 +22,7 @@ public NioServer( int port ) {
this.bootstrap = new ServerBootstrap( this.socketFactory );
LOG.info( "Server bootstrap options:");
this.bootstrap.setOption("child.tcpNoDelay", true);
+ this.bootstrap.setOption("child.reuseAddress", false);
this.bootstrap.setOption("child.keepAlive", true);
for( String key : this.bootstrap.getOptions( ).keySet( ) ) {
Object value = this.bootstrap.getOption( key );
View
41 clc/modules/wsstack/src/main/java/com/eucalyptus/ws/server/NioServerHandler.java
@@ -19,6 +19,7 @@
import org.jboss.netty.channel.ChannelPipelineFactory;
import org.jboss.netty.channel.ExceptionEvent;
import org.jboss.netty.channel.MessageEvent;
+import org.jboss.netty.channel.SimpleChannelHandler;
import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
import org.jboss.netty.handler.codec.frame.TooLongFrameException;
import org.jboss.netty.handler.codec.http.DefaultHttpResponse;
@@ -33,32 +34,38 @@
import org.jboss.netty.handler.stream.ChunkedFile;
import org.jboss.netty.handler.stream.ChunkedWriteHandler;
+import com.eucalyptus.ws.MappingHttpRequest;
import com.eucalyptus.ws.util.PipelineRegistry;
@ChannelPipelineCoverage( "one" )
-public class NioServerHandler extends SimpleChannelUpstreamHandler {
+public class NioServerHandler extends SimpleChannelHandler {
private static Logger LOG = Logger.getLogger( NioServerHandler.class );
private boolean first = true;
@Override
public void messageReceived( final ChannelHandlerContext ctx, final MessageEvent e ) throws Exception {
- synchronized ( this ) {
- if ( this.first ) {
- try {
- final HttpRequest request = ( HttpRequest ) e.getMessage( );
- final ChannelPipeline pipeline = ctx.getPipeline( );
- FilteredPipeline filteredPipeline = PipelineRegistry.getInstance( ).find( request );
- filteredPipeline.unroll( pipeline );
- this.first = false;
- } catch ( DuplicatePipelineException e1 ) {
- LOG.error( "This is a BUG: " + e1, e1 );
- throw e1;
- } catch ( NoAcceptingPipelineException e2 ) {
- throw e2;
- }
- }
+ if ( this.first ) {
+ lookupPipeline( ctx, e );
+ ctx.sendUpstream( e );
+ } else {
+ LOG.warn( "Hard close the socket on an attempt to do a second request. no u." );
+ ctx.getChannel( ).close( );
+ }
+ }
+
+ private void lookupPipeline( final ChannelHandlerContext ctx, final MessageEvent e ) throws DuplicatePipelineException, NoAcceptingPipelineException {
+ try {
+ final HttpRequest request = ( HttpRequest ) e.getMessage( );
+ final ChannelPipeline pipeline = ctx.getPipeline( );
+ FilteredPipeline filteredPipeline = PipelineRegistry.getInstance( ).find( request );
+ filteredPipeline.unroll( pipeline );
+ this.first = false;
+ } catch ( DuplicatePipelineException e1 ) {
+ LOG.error( "This is a BUG: " + e1, e1 );
+ throw e1;
+ } catch ( NoAcceptingPipelineException e2 ) {
+ throw e2;
}
- ctx.sendUpstream( e );
}
@Override

0 comments on commit a8cdc94

Please sign in to comment.