Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Don't keep connections open

  • Loading branch information...
commit 00f58d7cdaaa5ec32fe07130c08a791f52cffbad 1 parent 5153e50
@slandelle slandelle authored
View
5 ...order/src/main/scala/com/excilys/ebi/gatling/recorder/controller/RecorderController.scala
@@ -23,7 +23,6 @@ import scala.tools.nsc.io.{ Directory, File }
import scala.tools.nsc.io.Path.string2path
import org.codehaus.plexus.util.SelectorUtils
-import org.jboss.netty.channel.Channel
import org.jboss.netty.handler.codec.http.{ HttpMethod, HttpRequest, HttpResponse }
import org.jboss.netty.handler.codec.http.HttpHeaders.Names.PROXY_AUTHORIZATION
@@ -87,10 +86,6 @@ class RecorderController extends Logging {
}
}
- def registerChannel(channel: Channel) {
- proxy.registerChannel(channel)
- }
-
def receiveRequest(request: HttpRequest) {
synchronized {
// If Outgoing Proxy set, we record the credentials to use them when sending the request
View
5 gatling-recorder/src/main/scala/com/excilys/ebi/gatling/recorder/http/GatlingHttpProxy.scala
@@ -17,7 +17,6 @@ package com.excilys.ebi.gatling.recorder.http
import java.net.InetSocketAddress
-import org.jboss.netty.channel.Channel
import org.jboss.netty.channel.group.DefaultChannelGroup
import com.excilys.ebi.gatling.recorder.config.ProxyConfig
@@ -33,10 +32,6 @@ class GatlingHttpProxy(controller: RecorderController, port: Int, sslPort: Int,
group.add(bootstrap.bind(new InetSocketAddress(port)))
group.add(secureBootstrap.bind(new InetSocketAddress(sslPort)))
- def registerChannel(channel: Channel) {
- group.add(channel)
- }
-
def shutdown {
group.close.awaitUninterruptibly
}
View
6 ...n/scala/com/excilys/ebi/gatling/recorder/http/handler/AbstractBrowserRequestHandler.scala
@@ -19,8 +19,8 @@ import java.net.URI
import scala.collection.JavaConversions.asScalaBuffer
-import org.jboss.netty.channel.{ SimpleChannelHandler, MessageEvent, ExceptionEvent, ChannelHandlerContext, ChannelFutureListener, ChannelFuture }
-import org.jboss.netty.handler.codec.http.{ HttpRequest, DefaultHttpRequest }
+import org.jboss.netty.channel.{ ChannelFuture, ChannelFutureListener, ChannelHandlerContext, ExceptionEvent, MessageEvent, SimpleChannelHandler }
+import org.jboss.netty.handler.codec.http.{ DefaultHttpRequest, HttpRequest }
import com.excilys.ebi.gatling.http.Headers
import com.excilys.ebi.gatling.recorder.config.ProxyConfig
@@ -33,8 +33,6 @@ abstract class AbstractBrowserRequestHandler(controller: RecorderController, pro
override def messageReceived(ctx: ChannelHandlerContext, event: MessageEvent) {
- controller.registerChannel(ctx.getChannel)
-
event.getMessage match {
case request: HttpRequest =>
proxyConfig.host match {
View
8 .../main/scala/com/excilys/ebi/gatling/recorder/http/handler/ServerHttpResponseHandler.scala
@@ -15,8 +15,8 @@
*/
package com.excilys.ebi.gatling.recorder.http.handler
-import org.jboss.netty.channel.{ SimpleChannelHandler, MessageEvent, ChannelHandlerContext }
-import org.jboss.netty.handler.codec.http.{ HttpResponse, HttpRequest }
+import org.jboss.netty.channel.{ ChannelFutureListener, ChannelHandlerContext, MessageEvent, SimpleChannelHandler }
+import org.jboss.netty.handler.codec.http.{ HttpRequest, HttpResponse }
import com.excilys.ebi.gatling.recorder.controller.RecorderController
@@ -24,12 +24,10 @@ class ServerHttpResponseHandler(controller: RecorderController, requestContext:
override def messageReceived(context: ChannelHandlerContext, event: MessageEvent) {
- controller.registerChannel(context.getChannel)
-
event.getMessage match {
case response: HttpResponse =>
controller.receiveResponse(request, response)
- requestContext.getChannel.write(response) // Send back to client
+ requestContext.getChannel.write(response).addListener(ChannelFutureListener.CLOSE) // Send back to client
case _ => // whatever
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.