Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Port idlestatehandler 97#98

Merged
nayato merged 1 commit intoAzure:devfrom
avatar29A:port-idlestatehandler-97
May 16, 2016
Merged

Port idlestatehandler 97#98
nayato merged 1 commit intoAzure:devfrom
avatar29A:port-idlestatehandler-97

Conversation

@avatar29A
Copy link
Contributor

Implementation Idle connections and timeouts.

Modifications:

Added new handlers:

  • IdleStateHandler.cs
  • ReadTimeoutHandler
  • WriteTimeoutHandler
  • ChannelDuplexHandler

Added a new utils class for work with time:

  • TimeUtil.cs

@azurecla
Copy link

azurecla commented May 3, 2016

Hi @avatar29A, I'm your friendly neighborhood Azure Pull Request Bot (You can call me AZPRBOT). Thanks for your contribution!
You've already signed the contribution license agreement. Thanks!
We will now validate the agreement and then real humans will evaluate your PR.

TTYL, AZPRBOT;

/// <summary>
/// Time utility class.
/// </summary>
public static class TimeUtil
Copy link
Member

Choose a reason for hiding this comment

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

let's converge on PreciseTimeSpan for these things. ping me to discuss the details on integrating missing pieces there.

Copy link
Member

Choose a reason for hiding this comment

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

Also, with the other changes done, is there still a point in adding these utility methods?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll see tonight. If I'll change all code, which works with nanoseconds on TimeSpan, I think It will be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have changed IdleStateHandler and I am having there two methods, which I think, needs to be moved into a utils class.

        TimeSpan Max(TimeSpan t1, TimeSpan t2)
        {
            return TimeSpan.Compare(t1, t2) == 1 ? t1 : t2;
        }

      TimeSpan GetSystemTime()
        {
            return TimeSpan.FromMilliseconds(Environment.TickCount);
        }

Where do you think is better place for they?

@nayato
Copy link
Member

nayato commented May 10, 2016

@avatar29A #107 is in, see my comments inline regarding this. Please, rebase to latest dev and check the comments on WriteTimeoutHandler.

@avatar29A avatar29A force-pushed the port-idlestatehandler-97 branch from 731a617 to ef98333 Compare May 12, 2016 16:24
this.promise = promise;
this.handler = handler;

promise.ContinueWith(new Action<Task>(this.HandleOperationComplete));
Copy link
Member

Choose a reason for hiding this comment

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

use ContinueWith(Action<Task, object> action, object state) overload, pass this as a state, add a static readonly Action<Task, object> OperationCompleteAction = HandleOperationComplete; and derive WriteTimeoutTask out of state in HandleOperationComplete.

Copy link
Member

@nayato nayato May 13, 2016

Choose a reason for hiding this comment

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

also pass ExecuteSynchronously in ContinueWith

@nayato
Copy link
Member

nayato commented May 13, 2016

pls address the remaining comments, squash into a single commit and rebase to the latest dev. Apparently it has conflicts with current version.

@avatar29A avatar29A force-pushed the port-idlestatehandler-97 branch from ef98333 to 9742041 Compare May 14, 2016 08:38
@nayato
Copy link
Member

nayato commented May 15, 2016

@avatar29A looks good. Please squash and I'll be happy to merge!

Modifications:

Added new handlers:

- IdleStateHandler.cs
- ReadTimeoutHandler
- WriteTimeoutHandler
- ChannelDuplexHandler

Added a new utils class for work with time:

- TimeUtil.cs
@avatar29A avatar29A force-pushed the port-idlestatehandler-97 branch from 9742041 to c941859 Compare May 15, 2016 08:02
@avatar29A
Copy link
Contributor Author

Ready.

@nayato
Copy link
Member

nayato commented May 16, 2016

Thanks!

@nayato nayato merged commit 36ba08b into Azure:dev May 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants