Re: [go-nuts] Why does assigning a function variable to a method value allocate memory?

2017-08-23 Thread MartinG
Thanks for the fantastic explanation folks. I wonder if I can ask advice on how to improve my use case. I have a struct type that represents a state machine and each state is handled by a different method on that type, each with the same signature I use a function variable to represent the cu

[go-nuts] Why does assigning a function variable to a method value allocate memory?

2017-08-22 Thread MartinG
Hi, In the below code example, setting a function variable to a simple function makes no memory allocation and is very fast (<1ns). The case of setting the same function variable to a method value is much slower (~30ns) and it turns out to be because memory is allocated there. (16 B/op) I fou

[go-nuts] Re: Are there any plans for TLS 1.3?

2017-03-03 Thread MartinG
On Friday, March 3, 2017 at 9:47:35 PM UTC, Igor Gatis wrote: > > Or, is there any recommended early replacement? > It's being worked on: https://github.com/golang/go/issues/9671#issuecomment-282091772 It looks like Adam Langley will be working on it too during the 1.9 cycle, judging by a com

[go-nuts] Cancelling blocked Read()s and Write()s on net.Conn using a Context?

2017-03-02 Thread MartinG
Hi, I began to find it strange that most potentially blocking operations across the network for Dial, various http, sql and other things support context.Context, but basic Read() and Write on net.Conn do not. Instead they support a trick of setting the read or write deadlines to the past once

[go-nuts] Re: TCP RST and TLS

2016-08-09 Thread MartinG
> With plain TCP, a client write followed by a server read and finally a > client read results in the client getting a "connection reset" error. This > is expected and reflects the RST seen in a TCP packet as can be seen using > tcpdump. > Correction: I meant to say "a client write followed

[go-nuts] TCP RST and TLS

2016-08-09 Thread MartinG
Hi, I noticed a difference in how errors can be returned between a plain TCP connection and a TLS connection. With plain TCP, a client write followed by a server read and finally a client read results in the client getting a "connection reset" error. This is expected and reflects the RST seen