Implement async timeout listener on servlet backends. #9

It's the time between `startAsync` and either `complete` or `dispatch`. So
a hung body could trip it after the response is committed. I'll add a check
on that.
On Nov 21, 2014 7:35 AM, "Bryce Anderson" <notifications@github.com> wrote:

> In servlet/src/main/scala/org/http4s/servlet/Http4sServlet.scala:
>
> > @@ -42,6 +42,21 @@ class Http4sServlet(service: HttpService,
> >    private[this] var serverSoftware: ServerSoftware = _
> >    private[this] var inputStreamReader: BodyReader = _
> >
> > +  private class Http4sAsyncListener extends AsyncListener {
> > +    override def onComplete(event: AsyncEvent): Unit = {}
> > +
> > +    override def onError(event: AsyncEvent): Unit = logger.error(event.getThrowable)("Async error processing request")
> > +
> > +    override def onStartAsync(event: AsyncEvent): Unit = {}
> > +
> > +    override def onTimeout(event: AsyncEvent): Unit = {
> > +      val response = ResponseBuilder(Status.InternalServerError, "Service timed out.").run
>
> Just a question: what happens if the route stalls in the the body process?
> At that point the response line may have already been sent out. I suspect
> it will just close the socket.
>
> --
> Reply to this email directly or view it on GitHub
> <https://github.com/http4s/http4s/pull/78/files#r20714627>.
>