Skip to content

Commit 540257c

Browse files
committed
Fixed #105
1 parent 7458a87 commit 540257c

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

rpc/socket/handler.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
| |
77
| rpc/socket/handler.go |
88
| |
9-
| LastModified: Aug 24, 2021 |
9+
| LastModified: Nov 11, 2021 |
1010
| Author: Ma Bingyao <[email protected]> |
1111
| |
1212
\*________________________________________________________*/
@@ -17,6 +17,7 @@ import (
1717
"context"
1818
"crypto/tls"
1919
"io"
20+
"math"
2021
"net"
2122
"reflect"
2223
"time"
@@ -158,7 +159,7 @@ func (h *Handler) send(ctx context.Context, conn net.Conn, queue chan data, errC
158159
case response := <-queue:
159160
index, body, e := response.Index, response.Body, response.Error
160161
if e != nil {
161-
index |= int(0x80000000)
162+
index |= math.MinInt32
162163
if e == core.ErrRequestEntityTooLarge {
163164
body = []byte(core.RequestEntityTooLarge)
164165
} else {

rpc/websocket/handler.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
| |
77
| rpc/websocket/handler.go |
88
| |
9-
| LastModified: Aug 24, 2021 |
9+
| LastModified: Nov 11, 2021 |
1010
| Author: Ma Bingyao <[email protected]> |
1111
| |
1212
\*________________________________________________________*/
@@ -15,6 +15,7 @@ package websocket
1515

1616
import (
1717
"context"
18+
"math"
1819
"math/rand"
1920
"net"
2021
"net/http"
@@ -179,7 +180,7 @@ func (h *Handler) send(ctx context.Context, conn *websocket.Conn, queue chan dat
179180
case response := <-queue:
180181
index, body, e := response.Index, response.Body, response.Error
181182
if e != nil {
182-
index |= int(0x80000000)
183+
index |= math.MinInt32
183184
if e == core.ErrRequestEntityTooLarge {
184185
body = []byte(core.RequestEntityTooLarge)
185186
} else {

0 commit comments

Comments
 (0)