Releases: talostrading/sonic
Releases · talostrading/sonic
v0.9.2
v0.9.1
What's Changed
- (bugfix) Do not ignore
SO_ERROR
value onconnect
by @sergiu128 and @theodosiosandreou in #144
Full Changelog: v0.9.0...v0.9.1
v0.9.0
What's Changed
Changes related to the correctness of IO
:
- The per async-object stackframe counter
dispatched
is now inIO
. As such, there is one such counter shared between all async-objects sharing anIO
.- This counter ensures we don't overflow the stack when multiple async reads/writes can be immediately completed by an async-object. When this happens, we keep building up stackframes by invoking callbacks within callbacks. We limit the stackframe count to
32
by default. Once we hit the limit, even if an async read can be done immediately, we schedule it to be completed asynchronously. This pops all stackframes. - The problem arises when two or more objects build up each other's stackframes. Since the counter is per async object, we can run into a case like the following:
- on each async read, object 1 invokes an async read for object 2
- on each async read, object 2 invokes an async read for object 1
- all reads can be done immediately
- We only pop the stackframes once both objects hit their limit, since the counter is per object. That means we schedule immediate async reads for later only after our stack has grown by 64 frames, even though the limit is 32.
- With
n
objects, we stop atn * 32
stack frames. Ifn
is large, we get a stack overflow - By sharing the counter between all objects, we ensure we never build up more than 32 stackframes, no matter the value of
n
. SeeTestDispatchLimit
inconn_test.go
for an example. - The counter is now called
Dispatched
and lives in theIO
struct.
- This counter ensures we don't overflow the stack when multiple async reads/writes can be immediately completed by an async-object. When this happens, we keep building up stackframes by invoking callbacks within callbacks. We limit the stackframe count to
Performance improvements:
file.go
is alloc-free. That makes all TCP/UDP connections alloc-free. Instead of allocating a read/write handler on each async read/write, we allocate it once at connection init time and ensure we reset the handler's state at the start of each read/write. SeefileReadReactor
andfileWriteReactor
.
Also cleaned up some of the docs.
Full Changelog: v0.8.0...v0.9.0
v0.8.0
What's Changed
API changes in codec/websocket
. Might affect some websocket users.
- Removed the
Stream
interface. Removed theWebsocketStream
struct.NewWebsocketStream
now returns aStream
struct. AcquireFrame
is now aStream
method, not a global method anymore.ReleaseFrame
has been removed.- Users who wish to sends frames to the server must do it like so:
f := stream.AcquireFrame() // comes from a sync.Pool
f.SetFIN().SetPayload() // ...etc
stream.AsyncWriteFrame(f, ...)
// the frame is automatically released to the sync.Pool by the stream after the write completes
// the stream takes care to automatically mask the frame before sending it to the server
- Revised the implementation of
Frame
- it is now just a type alias to a byte slice, instead of a struct with 3 members:
header | mask | payload
- the setter methods like
SetFIN, SetPong etc
are now using the builder pattern
- it is now just a type alias to a byte slice, instead of a struct with 3 members:
- Simplified the
codec
implementation. No API changes here. - Added
SetMaxMessageSize
to set the maximum message size perStream
. Previously this was a global object, so all streams respected the set size.stream.MaxMessageSize
returns the currently set size - defaults to 512KB. - Added
ValidateUTF8(bool)
to optionally validate payloads as UTF-8 encoded per stream.ValidatesUTF8
returns whether validation is done on each frame or not. Not done by default. This also meansSupportsUTF8
now returnstrue
.
Full Changelog: v0.7.0...v0.8.0
v0.7.0
What's Changed
Breaking API change around the constructs in codec.go
.
- Removed
BlockingCodecConn
along with all its methods and constructors - Removed
NonblockingCodecConn
along with all its methods and constructors - The
CodecConn
interface is now astruct
. It implements the functionality of bothBlockingCodecConn
andNonblockingCodecConn
. - Users should replace
BlockingCodecConn
andNonblockingCodecConn
withCodecConn
.
Also removed the unused UDPMulticastClient
interface.
Full Changelog: v0.6.1...v0.7.0
v0.6.1
What's Changed
- Going open source by @sergiu128 in #117
- Use an array instead of a map for pending reads/writes by @sergiu128 in #111
- remove @0ms because its not a valid update speed per binance docs by @ccnlui in #123
New Contributors
Full Changelog: v0.6.0...v0.6.1
v0.6.0
v0.5.7
What's Changed
- Introduce a circular buffer that always returns continuous chunks by @sergiu128 in #105
- Correct verification of cpu pinning on linux by @sergiu128 in #112
Full Changelog: v0.5.6...v0.5.7
v0.5.6
What's Changed
- Websocket performance test by @sergiu128 in #92
- Remove obsolete UDPMulticastClient by @sergiu128 in #106
- Handle empty close frames correctly by @sergiu128 in #108
Full Changelog: v0.5.5...v0.5.6
v0.5.5
What's Changed
- Dynamically change a udp multicast peer's read buffer by @sergiu128 in #99
Full Changelog: v0.5.4...v0.5.5