Skip to content
This repository has been archived by the owner on Dec 18, 2018. It is now read-only.

Add keep-alive timeout (#464) #1066

Merged
merged 2 commits into from
Sep 6, 2016
Merged

Add keep-alive timeout (#464) #1066

merged 2 commits into from
Sep 6, 2016

Conversation

cesarblum
Copy link
Contributor

@cesarblum cesarblum commented Aug 25, 2016

This includes the libuv timer stuff in #1056 plus the keep-alive code.

~~There's a ~5% perf hit. I'm trying to improve that.~~
#464

cc @halter73 @mikeharder @davidfowl @Tratcher

{
if ((now - _requestEndTime) / NanosecondsPerSecond > ServerOptions.Limits.KeepAliveTimeout)
{
SocketInput.IncomingComplete(0, null);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

StopAsync()

@cesarblum
Copy link
Contributor Author

cesarblum commented Aug 25, 2016

Thanks @halter73 for the suggestion to count seconds between ticks instead of querying time. That fixed the perf regression 👍

@@ -8,5 +8,8 @@ public interface IConnectionControl
void Pause();
void Resume();
void End(ProduceEndType endType);

void NotifyRequestStarted();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these on IConnectionControl

Copy link
Contributor Author

@cesarblum cesarblum Aug 26, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you suggest? To me it makes sense to expose these here - you use these to signal the connection about request processing events so it can react accordingly.

Do you think I should introduce a new interface? IRequestStatusNotification or something along those lines?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be wrong to put them straight onto connection?

Copy link
Contributor Author

@cesarblum cesarblum Aug 26, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would require Frame to know about Connection - stronger coupling.

@cesarblum
Copy link
Contributor Author

@@ -1267,6 +1267,25 @@ protected void ReportApplicationError(Exception ex)
Log.ApplicationError(ConnectionId, ex);
}

public void Tick()
{
if (_requestProcessingStatus == RequestProcessingStatus.RequestPending && // we're in between requests and
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We almost never put comments at the end of a line. I get why you did it, but just put the comment above the if and use "and" in the comment.

@cesarblum
Copy link
Contributor Author

@halter73 Using TestServer and I'm tentatively addressing your concern about long standing tests in the last commit (d09230e).

@cesarblum
Copy link
Contributor Author

Travis test failure on OS X (https://travis-ci.org/aspnet/KestrelHttpServer/jobs/157181697) is not related to this change since it's showing up in other branches (https://travis-ci.org/aspnet/KestrelHttpServer/jobs/157157166, https://travis-ci.org/aspnet/KestrelHttpServer/jobs/155406648 - in the latter it was the other test in the class that failed).

Still waiting for a 🚢 or more feedback.

@@ -1277,7 +1295,7 @@ protected enum RequestLineStatus
Done
}

protected enum RequestProcessingStatus
public enum RequestProcessingStatus
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this now public when the field was made private?

@halter73
Copy link
Member

halter73 commented Sep 6, 2016

:shipit:

@cesarblum cesarblum merged commit f2085b1 into dev Sep 6, 2016
@cesarblum cesarblum deleted the cesarbs/timeouts branch September 6, 2016 22:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants