Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
K
koko
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
ops
koko
Commits
a777cc5a
Commit
a777cc5a
authored
Jan 06, 2020
by
Eric
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Bugfix] fix cpu high when input text stuck
parent
f2d74143
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
4 deletions
+10
-4
dbparser.go
pkg/proxy/dbparser.go
+3
-2
parser.go
pkg/proxy/parser.go
+3
-2
parsercmd.go
pkg/proxy/parsercmd.go
+4
-0
No files found.
pkg/proxy/dbparser.go
View file @
a777cc5a
...
@@ -65,8 +65,6 @@ func (p *DBParser) ParseStream(userInChan, srvInChan <-chan []byte) (userOut, sr
...
@@ -65,8 +65,6 @@ func (p *DBParser) ParseStream(userInChan, srvInChan <-chan []byte) (userOut, sr
close
(
p
.
cmdRecordChan
)
close
(
p
.
cmdRecordChan
)
close
(
p
.
userOutputChan
)
close
(
p
.
userOutputChan
)
close
(
p
.
srvOutputChan
)
close
(
p
.
srvOutputChan
)
_
=
p
.
cmdOutputParser
.
Close
()
_
=
p
.
cmdInputParser
.
Close
()
logger
.
Infof
(
"DB Session %s: Parser routine done"
,
p
.
id
)
logger
.
Infof
(
"DB Session %s: Parser routine done"
,
p
.
id
)
}()
}()
for
{
for
{
...
@@ -169,6 +167,9 @@ func (p *DBParser) Close() {
...
@@ -169,6 +167,9 @@ func (p *DBParser) Close() {
default
:
default
:
close
(
p
.
closed
)
close
(
p
.
closed
)
}
}
_
=
p
.
cmdOutputParser
.
Close
()
_
=
p
.
cmdInputParser
.
Close
()
logger
.
Infof
(
"DB Session %s: Parser close"
,
p
.
id
)
}
}
func
(
p
*
DBParser
)
sendCommandRecord
()
{
func
(
p
*
DBParser
)
sendCommandRecord
()
{
...
...
pkg/proxy/parser.go
View file @
a777cc5a
...
@@ -86,8 +86,6 @@ func (p *Parser) ParseStream(userInChan, srvInChan <-chan []byte) (userOut, srvO
...
@@ -86,8 +86,6 @@ func (p *Parser) ParseStream(userInChan, srvInChan <-chan []byte) (userOut, srvO
close
(
p
.
cmdRecordChan
)
close
(
p
.
cmdRecordChan
)
close
(
p
.
userOutputChan
)
close
(
p
.
userOutputChan
)
close
(
p
.
srvOutputChan
)
close
(
p
.
srvOutputChan
)
_
=
p
.
cmdOutputParser
.
Close
()
_
=
p
.
cmdInputParser
.
Close
()
logger
.
Infof
(
"Session %s: Parser routine done"
,
p
.
id
)
logger
.
Infof
(
"Session %s: Parser routine done"
,
p
.
id
)
}()
}()
for
{
for
{
...
@@ -271,6 +269,9 @@ func (p *Parser) Close() {
...
@@ -271,6 +269,9 @@ func (p *Parser) Close() {
close
(
p
.
closed
)
close
(
p
.
closed
)
}
}
_
=
p
.
cmdOutputParser
.
Close
()
_
=
p
.
cmdInputParser
.
Close
()
logger
.
Infof
(
"Session %s: Parser close"
,
p
.
id
)
}
}
func
(
p
*
Parser
)
sendCommandRecord
()
{
func
(
p
*
Parser
)
sendCommandRecord
()
{
...
...
pkg/proxy/parsercmd.go
View file @
a777cc5a
...
@@ -87,12 +87,16 @@ func (cp *CmdParser) initial() {
...
@@ -87,12 +87,16 @@ func (cp *CmdParser) initial() {
for
{
for
{
line
,
err
:=
cp
.
term
.
ReadLine
()
line
,
err
:=
cp
.
term
.
ReadLine
()
if
err
!=
nil
{
if
err
!=
nil
{
select
{
select
{
case
<-
cp
.
closed
:
case
<-
cp
.
closed
:
logger
.
Debugf
(
"Session %s %s term err: %s break loop"
,
cp
.
id
,
cp
.
name
,
err
)
break
loop
break
loop
default
:
default
:
}
}
logger
.
Debugf
(
"Session %s %s term err: %s,loop continue"
,
cp
.
id
,
cp
.
name
,
err
)
goto
loop
goto
loop
}
}
cp
.
lock
.
Lock
()
cp
.
lock
.
Lock
()
cp
.
currentLength
+=
len
(
line
)
cp
.
currentLength
+=
len
(
line
)
...
...
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