1. 18 Oct, 2016 1 commit
  2. 13 Oct, 2016 4 commits
  3. 12 Oct, 2016 1 commit
    • Artyom Pervukhin's avatar
      websocket: limit incoming payload size · 6dba816f
      Artyom Pervukhin authored
      Codec's Receive method calls io.ReadAll of the whole frame payload,
      which can be abused by user sending large payloads in order to exhaust
      server memory.
      
      Introduce limit on received payload size defined by
      Conn.MaxPayloadBytes. If payload size of the message read with
      Codec.Receive exceeds limit, ErrFrameTooLarge error is returned; the
      connection can still be recovered if required: the next call to Receive
      would at first discard leftovers of previous oversized message before
      processing the next one.
      
      Fixes golang/go#5082.
      
      Change-Id: Ib04acd7038474fee39a1719324daaec1c0c496b1
      Reviewed-on: https://go-review.googlesource.com/23590Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      6dba816f
  4. 11 Oct, 2016 1 commit
  5. 07 Oct, 2016 5 commits
    • Radu Berinde's avatar
      trace: don't allocate all events upfront · f4b625ec
      Radu Berinde authored
      SetMaxEvent allocates storage for all events, which is very expensive
      if we want to set a high value; even with small values, the
      unnecessary allocation of the initial slice is measurable.
      
      We improve the performance by having a few events preallocated as part
      of the trace, and appending as necessary. We also co-locate the flags
      in event which makes it smaller (by a word).
      
      We also add a set of benchmarks; before and after amortized cost
      per-event is shown:
      
      name                    old time/op  new time/op  delta
      Trace_Default_2-32      1.19µs ± 1%  0.96µs ± 0%  -18.94%
      Trace_Default_10-32      579ns ± 0%   635ns ± 1%   +9.82%
      Trace_Default_100-32     463ns ± 1%   466ns ± 1%     ~
      Trace_Default_1000-32    451ns ± 1%   451ns ± 0%     ~
      Trace_Default_10000-32   451ns ± 2%   449ns ± 1%     ~
      Trace_10_2-32           1.41µs ± 1%  0.96µs ± 1%  -31.74%
      Trace_10_10-32           623ns ± 1%   634ns ± 1%   +1.73%
      Trace_10_100-32          469ns ± 1%   466ns ± 1%     ~
      Trace_10_1000-32         452ns ± 1%   453ns ± 2%     ~
      Trace_10_10000-32        451ns ± 1%   449ns ± 1%     ~
      Trace_100_2-32          2.78µs ± 2%  0.97µs ± 1%  -65.28%
      Trace_100_10-32          912ns ± 1%   637ns ± 1%  -30.23%
      Trace_100_100-32         479ns ± 1%   541ns ± 0%  +12.77%
      Trace_100_1000-32        510ns ± 0%   541ns ± 1%   +6.08%
      Trace_100_10000-32       514ns ± 1%   540ns ± 0%   +5.14%
      Trace_1000_2-32         17.2µs ± 1%   1.0µs ± 1%  -94.39%
      Trace_1000_10-32        3.90µs ± 1%  0.64µs ± 0%  -83.68%
      Trace_1000_100-32        814ns ± 1%   542ns ± 0%  -33.46%
      Trace_1000_1000-32       503ns ± 1%   581ns ± 0%  +15.56%
      Trace_1000_10000-32     1.28µs ± 2%  1.03µs ± 1%  -19.68%
      
      Change-Id: I5bbc12153a9f30dff821ef139583cb1c07a11069
      Reviewed-on: https://go-review.googlesource.com/30615Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      f4b625ec
    • Brad Fitzpatrick's avatar
      Revert "trace: don't allocate all events upfront" · 9b4f494e
      Brad Fitzpatrick authored
      This reverts commit If7c68bb1809fb92fa5d06cb6640be5e09e1f131f.
      
      Reason for revert: breaks the build for Go 1.6 or below due to use of Go 1.7+ only features.
      
      Original change's description:
      > trace: don't allocate all events upfront
      > 
      > SetMaxEvent allocates storage for all events, which is very expensive
      > if we want to set a high value; even with small values, the
      > unnecessary allocation of the initial slice is measurable.
      > 
      > We improve the performance by having a few events preallocated as part
      > of the trace, and appending as necessary. We also co-locate the flags
      > in event which makes it smaller (by a word).
      > 
      > We also add a set of benchmarks; before and after amortized cost
      > per-event is shown:
      > 
      > name                 old time/op  new time/op  delta
      > Trace/0-2-32         1.19µs ± 1%  0.96µs ± 0%  -18.94%  (p=0.008 n=5+5)
      > Trace/0-10-32         579ns ± 0%   635ns ± 1%   +9.82%  (p=0.008 n=5+5)
      > Trace/0-100-32        463ns ± 1%   466ns ± 1%     ~     (p=0.190 n=5+5)
      > Trace/0-1000-32       451ns ± 1%   451ns ± 0%     ~     (p=0.984 n=5+5)
      > Trace/0-10000-32      451ns ± 2%   449ns ± 1%     ~     (p=0.492 n=5+5)
      > Trace/10-2-32        1.41µs ± 1%  0.96µs ± 1%  -31.74%  (p=0.008 n=5+5)
      > Trace/10-10-32        623ns ± 1%   634ns ± 1%   +1.73%  (p=0.008 n=5+5)
      > Trace/10-100-32       469ns ± 1%   466ns ± 1%     ~     (p=0.357 n=5+5)
      > Trace/10-1000-32      452ns ± 1%   453ns ± 2%     ~     (p=0.913 n=5+5)
      > Trace/10-10000-32     451ns ± 1%   449ns ± 1%     ~     (p=0.175 n=5+5)
      > Trace/100-2-32       2.78µs ± 2%  0.97µs ± 1%  -65.28%  (p=0.008 n=5+5)
      > Trace/100-10-32       912ns ± 1%   637ns ± 1%  -30.23%  (p=0.008 n=5+5)
      > Trace/100-100-32      479ns ± 1%   541ns ± 0%  +12.77%  (p=0.008 n=5+5)
      > Trace/100-1000-32     510ns ± 0%   541ns ± 1%   +6.08%  (p=0.008 n=5+5)
      > Trace/100-10000-32    514ns ± 1%   540ns ± 0%   +5.14%  (p=0.008 n=5+5)
      > Trace/1000-2-32      17.2µs ± 1%   1.0µs ± 1%  -94.39%  (p=0.008 n=5+5)
      > Trace/1000-10-32     3.90µs ± 1%  0.64µs ± 0%  -83.68%  (p=0.008 n=5+5)
      > Trace/1000-100-32     814ns ± 1%   542ns ± 0%  -33.46%  (p=0.008 n=5+5)
      > Trace/1000-1000-32    503ns ± 1%   581ns ± 0%  +15.56%  (p=0.008 n=5+5)
      > Trace/1000-10000-32  1.28µs ± 2%  1.03µs ± 1%  -19.68%  (p=0.008 n=5+5)
      > 
      > Change-Id: If7c68bb1809fb92fa5d06cb6640be5e09e1f131f
      > Reviewed-on: https://go-review.googlesource.com/30374
      > Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      > TryBot-Result: Gobot Gobot <gobot@golang.org>
      > Reviewed-by: Ian Lance Taylor <iant@golang.org>
      > 
      
      Change-Id: I7cf25464ae836489e0af4a59a4d534a5d25ee352
      Reviewed-on: https://go-review.googlesource.com/30650Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      9b4f494e
    • Mikio Hara's avatar
      lif: rename internal types and constants generated by cgo · 084869ab
      Mikio Hara authored
      To match up with other packages that work with IP protocol stack.
      
      Change-Id: Idc3ee5b2399c4982dbd9114aac441f6d7452aeef
      Reviewed-on: https://go-review.googlesource.com/30576
      Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      084869ab
    • Mikio Hara's avatar
      ipv6: rename internal types and constants generated by cgo · 30df40a6
      Mikio Hara authored
      To match up with other packages that work with IP protocol stack.
      
      Change-Id: I1f4eb76051964766113914c9698233022e73d5eb
      Reviewed-on: https://go-review.googlesource.com/30575
      Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      30df40a6
    • Mikio Hara's avatar
      ipv4: rename internal types and constants generated by cgo · a14f429b
      Mikio Hara authored
      To match up with other packages that work with IP protocol stack.
      
      Change-Id: I2d20e4194617b05b6b46d6fba5df1f6c12ae2793
      Reviewed-on: https://go-review.googlesource.com/30574
      Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      a14f429b
  6. 06 Oct, 2016 5 commits
    • Radu Berinde's avatar
      trace: don't allocate all events upfront · 88c1a61b
      Radu Berinde authored
      SetMaxEvent allocates storage for all events, which is very expensive
      if we want to set a high value; even with small values, the
      unnecessary allocation of the initial slice is measurable.
      
      We improve the performance by having a few events preallocated as part
      of the trace, and appending as necessary. We also co-locate the flags
      in event which makes it smaller (by a word).
      
      We also add a set of benchmarks; before and after amortized cost
      per-event is shown:
      
      name                 old time/op  new time/op  delta
      Trace/0-2-32         1.19µs ± 1%  0.96µs ± 0%  -18.94%  (p=0.008 n=5+5)
      Trace/0-10-32         579ns ± 0%   635ns ± 1%   +9.82%  (p=0.008 n=5+5)
      Trace/0-100-32        463ns ± 1%   466ns ± 1%     ~     (p=0.190 n=5+5)
      Trace/0-1000-32       451ns ± 1%   451ns ± 0%     ~     (p=0.984 n=5+5)
      Trace/0-10000-32      451ns ± 2%   449ns ± 1%     ~     (p=0.492 n=5+5)
      Trace/10-2-32        1.41µs ± 1%  0.96µs ± 1%  -31.74%  (p=0.008 n=5+5)
      Trace/10-10-32        623ns ± 1%   634ns ± 1%   +1.73%  (p=0.008 n=5+5)
      Trace/10-100-32       469ns ± 1%   466ns ± 1%     ~     (p=0.357 n=5+5)
      Trace/10-1000-32      452ns ± 1%   453ns ± 2%     ~     (p=0.913 n=5+5)
      Trace/10-10000-32     451ns ± 1%   449ns ± 1%     ~     (p=0.175 n=5+5)
      Trace/100-2-32       2.78µs ± 2%  0.97µs ± 1%  -65.28%  (p=0.008 n=5+5)
      Trace/100-10-32       912ns ± 1%   637ns ± 1%  -30.23%  (p=0.008 n=5+5)
      Trace/100-100-32      479ns ± 1%   541ns ± 0%  +12.77%  (p=0.008 n=5+5)
      Trace/100-1000-32     510ns ± 0%   541ns ± 1%   +6.08%  (p=0.008 n=5+5)
      Trace/100-10000-32    514ns ± 1%   540ns ± 0%   +5.14%  (p=0.008 n=5+5)
      Trace/1000-2-32      17.2µs ± 1%   1.0µs ± 1%  -94.39%  (p=0.008 n=5+5)
      Trace/1000-10-32     3.90µs ± 1%  0.64µs ± 0%  -83.68%  (p=0.008 n=5+5)
      Trace/1000-100-32     814ns ± 1%   542ns ± 0%  -33.46%  (p=0.008 n=5+5)
      Trace/1000-1000-32    503ns ± 1%   581ns ± 0%  +15.56%  (p=0.008 n=5+5)
      Trace/1000-10000-32  1.28µs ± 2%  1.03µs ± 1%  -19.68%  (p=0.008 n=5+5)
      
      Change-Id: If7c68bb1809fb92fa5d06cb6640be5e09e1f131f
      Reviewed-on: https://go-review.googlesource.com/30374
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      88c1a61b
    • Mikio Hara's avatar
      ipv6: don't refer to cgo-generated union field · 2a824cf9
      Mikio Hara authored
      The size of sockaddr_storage is fixed for interoperability on each
      platform. There is no need to depend on changable cgo-generated
      offset values.
      
      Change-Id: I54b775b2a8c86d969a6da0398a335075f0cbe3df
      Reviewed-on: https://go-review.googlesource.com/30178
      Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      2a824cf9
    • Mikio Hara's avatar
      ipv4: don't refer to cgo-generated union field · 534e1870
      Mikio Hara authored
      The size of sockaddr_storage is fixed for interoperability on each
      platform. There is no need to depend on changable cgo-generated
      offset values.
      
      Change-Id: I7469fe330d49867bbdbdfae128834140244925ec
      Reviewed-on: https://go-review.googlesource.com/30177
      Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      534e1870
    • Mikio Hara's avatar
      ipv6: add support for solaris · a7769702
      Mikio Hara authored
      This change adds support for Solaris.
      
      To read and write IPv6 ancillary data using ControlMessage, ipv6 pacakge
      requires https://go-review.googlesource.com/30171/
      
      Note: Unlike other platforms, Solaris seems to have a few restrictions
      on ICMP property access via raw IP sockets. At least applications are
      prohibited from using IPV6_CHECKSUM option for ICMP transport.
      
      Fixes golang/go#17324.
      
      Change-Id: Ie014665d94ae6e4955c95d3eea88db90332e20bd
      Reviewed-on: https://go-review.googlesource.com/30176
      Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      a7769702
    • Mikio Hara's avatar
      ipv4: add support for solaris · c8c327cf
      Mikio Hara authored
      This change adds support for Solaris.
      
      To read and write IPv4 ancillary data using ControlMessage, ipv4 pacakge
      requires https://go-review.googlesource.com/30171/
      
      Note: Unlike other platforms, Solaris seems to have a few restrictions
      on ICMP property access via raw IP sockets. At least applications are
      prohibited from using IP_RECVTTL option for ICMP transport.
      
      Fixes golang/go#17323.
      
      Change-Id: Icb6dfa3c8eced28d14693ddfea4601301999d735
      Reviewed-on: https://go-review.googlesource.com/30175
      Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      c8c327cf
  7. 03 Oct, 2016 4 commits
  8. 01 Oct, 2016 3 commits
  9. 30 Sep, 2016 2 commits
    • Brad Fitzpatrick's avatar
      http2: in Server, disarm connection's ReadTimeout after first request · 69729301
      Brad Fitzpatrick authored
      Fix a regression from Go 1.5 to Go 1.6: when we introduced automatic
      HTTP/2 support in Go 1.6, we never handled Server.ReadTimeout. If a
      user set ReadTimeout, the net/http package would set the read deadline
      on the connection during the TLS handshake, but then the http2 package
      would never disarm it, killing the likely-still-in-use connection
      after the timeout period.
      
      This CL changes it to disarm the timeout after the first request
      headers, similar to net/http.Server.
      
      Unlike net/http.Server, we don't re-arm it on each idle period,
      because the definition of idle is more complicated with HTTP/2.
      
      No tests here for now. Tests will be in the go repo once all the knobs
      are in place and this is re-bundled into std, testing both http1 and
      http2.
      
      Updates golang/go#16450 (minimal fix for now)
      Updates golang/go#14204 (considering a new http1+http2 IdleTimeout knob)
      
      Change-Id: Iaa1570c118efda7dc0a65ba84cd77885699ec8fc
      Reviewed-on: https://go-review.googlesource.com/30077Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      69729301
    • Brad Fitzpatrick's avatar
      http2: add Transport support for IdleConnTimeout · a333c534
      Brad Fitzpatrick authored
      Tests will be in the go repo's net/http package when this
      package is re-bundled into std.
      
      Updates golang/go#16808 (fixes after bundle into std)
      
      Change-Id: Iad31dc120bc008b1e9679bf7b2b988aac9c893c8
      Reviewed-on: https://go-review.googlesource.com/30075
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      a333c534
  10. 29 Sep, 2016 4 commits
  11. 24 Sep, 2016 3 commits
  12. 21 Sep, 2016 1 commit
  13. 20 Sep, 2016 1 commit
  14. 16 Sep, 2016 1 commit
  15. 14 Sep, 2016 2 commits
  16. 12 Sep, 2016 2 commits