good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
websocket
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
github
nhooyr
websocket
Commits
ff63b191
Unverified
Commit
ff63b191
authored
Sep 27, 2019
by
Anmol Sethi
Browse files
Options
Downloads
Patches
Plain Diff
Fix unaligned 64 bit atomic loads on 32 bit platforms
Closes #153
parent
0e007607
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
conn.go
+3
-2
3 additions, 2 deletions
conn.go
conn_common.go
+1
-1
1 addition, 1 deletion
conn_common.go
websocket_js.go
+1
-1
1 addition, 1 deletion
websocket_js.go
with
5 additions
and
4 deletions
conn.go
+
3
−
2
View file @
ff63b191
...
...
@@ -70,7 +70,8 @@ type Conn struct {
activeReader
*
messageReader
// readFrameLock is acquired to read from bw.
readFrameLock
chan
struct
{}
readClosed
int64
// Not int32 because of https://github.com/nhooyr/websocket/issues/153
readClosed
int32
readHeaderBuf
[]
byte
controlPayloadBuf
[]
byte
...
...
@@ -341,7 +342,7 @@ func (c *Conn) handleControl(ctx context.Context, h header) error {
// See https://github.com/nhooyr/websocket/issues/87#issue-451703332
// Most users should not need this.
func
(
c
*
Conn
)
Reader
(
ctx
context
.
Context
)
(
MessageType
,
io
.
Reader
,
error
)
{
if
atomic
.
LoadInt
64
(
&
c
.
readClosed
)
==
1
{
if
atomic
.
LoadInt
32
(
&
c
.
readClosed
)
==
1
{
return
0
,
nil
,
fmt
.
Errorf
(
"websocket connection read closed"
)
}
...
...
This diff is collapsed.
Click to expand it.
conn_common.go
+
1
−
1
View file @
ff63b191
...
...
@@ -178,7 +178,7 @@ func (c *netConn) SetReadDeadline(t time.Time) error {
// Use this when you do not want to read data messages from the connection anymore but will
// want to write messages to it.
func
(
c
*
Conn
)
CloseRead
(
ctx
context
.
Context
)
context
.
Context
{
atomic
.
StoreInt
64
(
&
c
.
readClosed
,
1
)
atomic
.
StoreInt
32
(
&
c
.
readClosed
,
1
)
ctx
,
cancel
:=
context
.
WithCancel
(
ctx
)
go
func
()
{
...
...
This diff is collapsed.
Click to expand it.
websocket_js.go
+
1
−
1
View file @
ff63b191
...
...
@@ -89,7 +89,7 @@ func (c *Conn) closeWithInternal() {
// Read attempts to read a message from the connection.
// The maximum time spent waiting is bounded by the context.
func
(
c
*
Conn
)
Read
(
ctx
context
.
Context
)
(
MessageType
,
[]
byte
,
error
)
{
if
atomic
.
LoadInt
64
(
&
c
.
readClosed
)
==
1
{
if
atomic
.
LoadInt
32
(
&
c
.
readClosed
)
==
1
{
return
0
,
nil
,
fmt
.
Errorf
(
"websocket connection read closed"
)
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment