FAQ
I've recently found myself desiring a nice interface for setting the
per-connection TCP keepalive options[1]; we can turn them on via the net
library, but can't configure the delay, which per the RFC cannot default to
anything less than two hours. I propose the following addition to
go.net/ipv4 (and ipv6?):


// SetKeepalive configures the per-connection keepalive settings to start
sending
// keepalives after the given duration and every interval until count have
been sent
// without an ack, after which time the connection will be reset.
func (c *Conn) SetKeepalive(after, interval time.Duration, count int) error

Alternately, a less direct transliteration would be:

// SetKeepalive configures the per-connection keepalive settings to start
sending
// keepalives after the given duration and every interval until max time
has passed from
// the first keepalive, after which time the connection will be reset. It
is an error for max
// to be anything but a multiple of interval.
func (c *Conn) SetKeepalive(after, max, interval time.Duration) error

... and the corresponding Keepalive() function with corresponding return
values.

Does anyone have strong feelings about this? Should I work on a CL or is
this something I should just do for myself?

[1] http://tools.ietf.org/html/rfc1122#page-101

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • Alex at Jul 27, 2013 at 5:49 pm
    I certainly think it seems like a nice helper as long as it can be
    implemented to have 0 or near 0 impact on performance, and be turned off by
    default to maintain compatibility. I am wondering what your plan for
    implementation is also, as it seems it might require a lot of refactoring.
      Do you plan on adding keepalive as a member of Conn, nil by default, but a
    struct with time properties and it's own channel when turned on? Then all
    receive calls would send a message to the channel IF keepalive != nil?
      Should sends also generate a message?

    Regards,
    Alex
    On Saturday, July 27, 2013 6:39:03 AM UTC-4, Kyle Lemons wrote:

    I've recently found myself desiring a nice interface for setting the
    per-connection TCP keepalive options[1]; we can turn them on via the net
    library, but can't configure the delay, which per the RFC cannot default to
    anything less than two hours. I propose the following addition to
    go.net/ipv4 (and ipv6?):


    // SetKeepalive configures the per-connection keepalive settings to start
    sending
    // keepalives after the given duration and every interval until count have
    been sent
    // without an ack, after which time the connection will be reset.
    func (c *Conn) SetKeepalive(after, interval time.Duration, count int) error

    Alternately, a less direct transliteration would be:

    // SetKeepalive configures the per-connection keepalive settings to start
    sending
    // keepalives after the given duration and every interval until max time
    has passed from
    // the first keepalive, after which time the connection will be reset. It
    is an error for max
    // to be anything but a multiple of interval.
    func (c *Conn) SetKeepalive(after, max, interval time.Duration) error

    ... and the corresponding Keepalive() function with corresponding return
    values.

    Does anyone have strong feelings about this? Should I work on a CL or is
    this something I should just do for myself?

    [1] http://tools.ietf.org/html/rfc1122#page-101
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Nkatsaros at Jul 27, 2013 at 9:17 pm
    Check out this CL https://codereview.appspot.com/11130044/ which was
    submitted recently that adds the ability to set the period and interval to
    the same value on Linux/Darwin/BSD. I've also created this CL
    https://codereview.appspot.com/11393043/ to add Windows support but have
    not mailed it because I haven't had time to test if it works properly.

    An implementation that sets all values would be nice but isn't possible
    because each OS has different support for these features.
    On Saturday, July 27, 2013 6:39:03 AM UTC-4, Kyle Lemons wrote:

    I've recently found myself desiring a nice interface for setting the
    per-connection TCP keepalive options[1]; we can turn them on via the net
    library, but can't configure the delay, which per the RFC cannot default to
    anything less than two hours. I propose the following addition to
    go.net/ipv4 (and ipv6?):


    // SetKeepalive configures the per-connection keepalive settings to start
    sending
    // keepalives after the given duration and every interval until count have
    been sent
    // without an ack, after which time the connection will be reset.
    func (c *Conn) SetKeepalive(after, interval time.Duration, count int) error

    Alternately, a less direct transliteration would be:

    // SetKeepalive configures the per-connection keepalive settings to start
    sending
    // keepalives after the given duration and every interval until max time
    has passed from
    // the first keepalive, after which time the connection will be reset. It
    is an error for max
    // to be anything but a multiple of interval.
    func (c *Conn) SetKeepalive(after, max, interval time.Duration) error

    ... and the corresponding Keepalive() function with corresponding return
    values.

    Does anyone have strong feelings about this? Should I work on a CL or is
    this something I should just do for myself?

    [1] http://tools.ietf.org/html/rfc1122#page-101
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Kyle Lemons at Jul 29, 2013 at 10:03 pm

    On Sat, Jul 27, 2013 at 2:17 PM, nkatsaros wrote:

    Check out this CL https://codereview.appspot.com/11130044/ which was
    submitted recently that adds the ability to set the period and interval to
    the same value on Linux/Darwin/BSD. I've also created this CL
    https://codereview.appspot.com/11393043/ to add Windows support but have
    not mailed it because I haven't had time to test if it works properly.

    An implementation that sets all values would be nice but isn't possible
    because each OS has different support for these features.
    Aha! Very cool.
    On Saturday, July 27, 2013 6:39:03 AM UTC-4, Kyle Lemons wrote:

    I've recently found myself desiring a nice interface for setting the
    per-connection TCP keepalive options[1]; we can turn them on via the net
    library, but can't configure the delay, which per the RFC cannot default to
    anything less than two hours. I propose the following addition to
    go.net/ipv4 (and ipv6?):


    // SetKeepalive configures the per-connection keepalive settings to start
    sending
    // keepalives after the given duration and every interval until count
    have been sent
    // without an ack, after which time the connection will be reset.
    func (c *Conn) SetKeepalive(after, interval time.Duration, count int)
    error

    Alternately, a less direct transliteration would be:

    // SetKeepalive configures the per-connection keepalive settings to start
    sending
    // keepalives after the given duration and every interval until max time
    has passed from
    // the first keepalive, after which time the connection will be reset.
    It is an error for max
    // to be anything but a multiple of interval.
    func (c *Conn) SetKeepalive(after, max, interval time.Duration) error

    ... and the corresponding Keepalive() function with corresponding return
    values.

    Does anyone have strong feelings about this? Should I work on a CL or is
    this something I should just do for myself?

    [1] http://tools.ietf.org/html/**rfc1122#page-101<http://tools.ietf.org/html/rfc1122#page-101>
    --
    You received this message because you are subscribed to the Google Groups
    "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedJul 27, '13 at 10:39a
activeJul 29, '13 at 10:03p
posts4
users3
websitegolang.org

3 users in discussion

Kyle Lemons: 2 posts Nkatsaros: 1 post Alex: 1 post

People

Translate

site design / logo © 2022 Grokbase