Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Limiting connections

Thanks for the response Greg.  After writing the response and calling shutdownOutput(), how do I set a forceful close timeout?

Thanks,
Josh

On Thu, May 20, 2021 at 3:09 PM Greg Wilkins <gregw@xxxxxxxxxxx> wrote:
There is nothing preventing you accepting a connection and then immediately sending an error response assuming a request is coming, and half closing the connection. You can then give it a Connection class that just consumes any characters received up to a low limit or short timeout.



On Fri, 21 May 2021, 05:02 Josh Spiegel, <joshlakewg@xxxxxxxxx> wrote:
Hi,

I'm using Jetty with a custom Connection/ConnectionFactory.  

I want to impose a connection limit and I don't want to abruptly close the connection without providing an error to the client.  Rather, I'd like to send an error message and then close the connection.  But I can't send the error response until I have received the first request.  I don't have control over when the client sends the first request but it would typically be shortly after the connection is established. 

What is the best way to do this? 

One idea I have is:
(1) when the connection is created, schedule a task that will come back and close it within some short period (a few seconds)
(2) if within that period, I get a request, send the error and then close the connection on the endPoint() write callback.

Thanks,
Josh



_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jetty-users
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jetty-users

Back to the top