Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
G
getty
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wei.xuan
getty
Commits
409eb868
Commit
409eb868
authored
Oct 26, 2021
by
AlexStocks
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Imp: using gxbytes.Buffer WriteNextBegin/WriteNextEnd
parent
d58f9f35
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
11 deletions
+7
-11
go.mod
go.mod
+1
-1
go.sum
go.sum
+2
-2
session.go
session.go
+4
-8
No files found.
go.mod
View file @
409eb868
...
...
@@ -3,7 +3,7 @@ module github.com/apache/dubbo-getty
go 1.14
require (
github.com/dubbogo/gost v1.11.1
2
github.com/dubbogo/gost v1.11.1
9
github.com/golang/snappy v0.0.1
github.com/gorilla/websocket v1.4.2
github.com/montanaflynn/stats v0.6.6
...
...
go.sum
View file @
409eb868
...
...
@@ -79,8 +79,8 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
github.com/dubbogo/go-zookeeper v1.0.3/go.mod h1:fn6n2CAEer3novYgk9ULLwAjuV8/g4DdC2ENwRb6E+c=
github.com/dubbogo/gost v1.11.1
2 h1:e3861DxHWe509whpMxS6mFBmgmm7r9+bT5iJ/PRufcw
=
github.com/dubbogo/gost v1.11.1
2
/go.mod h1:vIcP9rqz2KsXHPjsAwIUtfJIJjppQLQDcYaZTy/61jI=
github.com/dubbogo/gost v1.11.1
9 h1:R1rZ3TNJKV9W5XHLMv+GDO2Wy6UDnwGQtVWbsWYvo0A
=
github.com/dubbogo/gost v1.11.1
9
/go.mod h1:vIcP9rqz2KsXHPjsAwIUtfJIJjppQLQDcYaZTy/61jI=
github.com/dubbogo/jsonparser v1.0.1/go.mod h1:tYAtpctvSP/tWw4MeelsowSPgXQRVHHWbqL6ynps8jU=
github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
...
...
session.go
View file @
409eb868
...
...
@@ -597,17 +597,12 @@ func (s *session) handleTCPPackage() error {
exit
bool
bufLen
int
pkgLen
int
bufp
*
[]
byte
buf
[]
byte
pktBuf
*
bytes
.
Buffer
pktBuf
*
gx
bytes
.
Buffer
pkg
interface
{}
)
// buf = make([]byte, maxReadBufLen)
bufp
=
gxbytes
.
GetBytes
(
maxReadBufLen
)
buf
=
*
bufp
pktBuf
=
new
(
bytes
.
Buffer
)
pktBuf
=
gxbytes
.
NewBuffer
(
nil
)
conn
=
s
.
Connection
.
(
*
gettyTCPConn
)
for
{
...
...
@@ -622,6 +617,7 @@ func (s *session) handleTCPPackage() error {
for
{
// for clause for the network timeout condition check
// s.conn.SetReadTimeout(time.Now().Add(s.rTimeout))
buf
=
pktBuf
.
WriteNextBegin
(
maxReadBufLen
)
bufLen
,
err
=
conn
.
recv
(
buf
)
if
err
!=
nil
{
if
netError
,
ok
=
perrors
.
Cause
(
err
)
.
(
net
.
Error
);
ok
&&
netError
.
Timeout
()
{
...
...
@@ -646,7 +642,7 @@ func (s *session) handleTCPPackage() error {
break
}
if
0
!=
bufLen
{
pktBuf
.
Write
(
buf
[
:
bufLen
]
)
pktBuf
.
Write
NextEnd
(
bufLen
)
for
{
if
pktBuf
.
Len
()
<=
0
{
break
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment