Skip to content

Tags: algorand/websocket

Tags

v1.4.6

Toggle v1.4.6's commit message
Introduce MaxHeaderSize for respose reader. Bump to go1.17

v1.4.5

Toggle v1.4.5's commit message
update to use go 1.16

v1.4.4

Toggle v1.4.4's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Fix write lock deadline handling (#7)

## Issue

The existing code in go-algorand is using two go-routines for reading/writing and a separate go-routine for opening/closing the connections.
When a client connection becomes non-responsive ( i.e. the writer is not returning ), the current implementation tries to close the connection. However, per WebSocket specification, the client is supposed to send a Close message first.

The close message is being sent using the `WriteControl` method, which is supposed to be able to run concurrently with `WriteMessage`. However, both reaches `Conn.write` where it attempt to acquire a writing lock.

Since the `WriteMessage -> Conn.write` is stuck ( but the `WriteControl` doesn't really know it's stuck indefinitely ), the `WriteControl -> Conn.write` get blocks indefinitely as well.

Unlike the `WriteMessage`, when calling `WriteControl`, we provide a deadline : a timestamp after which we don't care if the message was actually sent. In this PR, I have added handling that would limit the time the `Conn.write` would wait to that deadline. 

From spec perspective, it would be a violation of the WebSocket protocol; however, given that the other party is no longer responsive, a successful writing of a Close message is not possible, it would probably be just fine.

v1.4.3

Toggle v1.4.3's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Merge pull request #6 from algorand/tsachi/properclose

flush the connection when writing control messages

v1.4.2

Toggle v1.4.2's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Merge pull request #4 from algorand/tsachi/fixleakygoroutine

Fix a leaky go-routine on server side connections

v1.4.1

Toggle v1.4.1's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Merge pull request #3 from algobolson/WriteControl_fix

Fix Conn.WriteControl() to use the same underlying Conn.write() as regular messages so that it does buffering properly.
Add tests that WriteControl() and WriteMessage() can both correctly send a CloseMessage

v1.4.0

Toggle v1.4.0's commit message
Move context to first parameter in DialContext

Follows best practice and pkg/context documentation:

> The Context should be the first parameter, typically named ctx

v1.3.0

Toggle v1.3.0's commit message
Improve server subprotocol documentation

Partial fix for 404.

v1.2.0

Toggle v1.2.0's commit message
Reduce memory used in chat example

v1.1.0

Toggle v1.1.0's commit message
pool flate writers