Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
2
22a7f0099
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Summer2022
22a7f0099
Commits
4f3d4ffb
Commit
4f3d4ffb
authored
4 years ago
by
fangyincheng
Browse files
Options
Downloads
Plain Diff
Mrg: fixed conflicts
parents
0f12ccb4
163d645c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
config/remote_config.go
+1
-1
1 addition, 1 deletion
config/remote_config.go
remoting/getty/getty_server.go
+30
-14
30 additions, 14 deletions
remoting/getty/getty_server.go
with
31 additions
and
15 deletions
config/remote_config.go
+
1
−
1
View file @
4f3d4ffb
...
...
@@ -40,7 +40,7 @@ type RemoteConfig struct {
TimeoutStr
string
`default:"5s" yaml:"timeout" json:"timeout,omitempty"`
Username
string
`yaml:"username" json:"username,omitempty" property:"username"`
Password
string
`yaml:"password" json:"password,omitempty" property:"password"`
Params
map
[
string
]
string
`yaml:"params" json:"
addres
s,omitempty"`
Params
map
[
string
]
string
`yaml:"params" json:"
param
s,omitempty"`
}
// Timeout return timeout duration.
...
...
This diff is collapsed.
Click to expand it.
remoting/getty/getty_server.go
+
30
−
14
View file @
4f3d4ffb
...
...
@@ -26,6 +26,7 @@ import (
import
(
"github.com/apache/dubbo-getty"
gxsync
"github.com/dubbogo/gost/sync"
perrors
"github.com/pkg/errors"
"gopkg.in/yaml.v2"
)
...
...
@@ -45,7 +46,6 @@ var (
)
func
initServer
(
protocol
string
)
{
// load clientconfig from provider_config
// default use dubbo
providerConfig
:=
config
.
GetProviderConfig
()
...
...
@@ -98,8 +98,11 @@ func GetServerConfig() ServerConfig {
// SetServerGrpool set getty server GrPool
func
SetServerGrpool
()
{
if
srvConf
.
GrPoolSize
>
1
{
srvGrpool
=
gxsync
.
NewTaskPool
(
gxsync
.
WithTaskPoolTaskPoolSize
(
srvConf
.
GrPoolSize
),
gxsync
.
WithTaskPoolTaskQueueLength
(
srvConf
.
QueueLen
),
gxsync
.
WithTaskPoolTaskQueueNumber
(
srvConf
.
QueueNumber
))
srvGrpool
=
gxsync
.
NewTaskPool
(
gxsync
.
WithTaskPoolTaskPoolSize
(
srvConf
.
GrPoolSize
),
gxsync
.
WithTaskPoolTaskQueueLength
(
srvConf
.
QueueLen
),
gxsync
.
WithTaskPoolTaskQueueNumber
(
srvConf
.
QueueNumber
),
)
}
}
...
...
@@ -136,6 +139,7 @@ func (s *Server) newSession(session getty.Session) error {
var
(
ok
bool
tcpConn
*
net
.
TCPConn
err
error
)
conf
:=
s
.
conf
...
...
@@ -160,13 +164,29 @@ func (s *Server) newSession(session getty.Session) error {
panic
(
fmt
.
Sprintf
(
"%s, session.conn{%#v} is not tcp connection
\n
"
,
session
.
Stat
(),
session
.
Conn
()))
}
tcpConn
.
SetNoDelay
(
conf
.
GettySessionParam
.
TcpNoDelay
)
tcpConn
.
SetKeepAlive
(
conf
.
GettySessionParam
.
TcpKeepAlive
)
if
conf
.
GettySessionParam
.
TcpKeepAlive
{
tcpConn
.
SetKeepAlivePeriod
(
conf
.
GettySessionParam
.
keepAlivePeriod
)
if
_
,
ok
=
session
.
Conn
()
.
(
*
tls
.
Conn
);
!
ok
{
if
tcpConn
,
ok
=
session
.
Conn
()
.
(
*
net
.
TCPConn
);
!
ok
{
return
perrors
.
New
(
fmt
.
Sprintf
(
"%s, session.conn{%#v} is not tcp connection"
,
session
.
Stat
(),
session
.
Conn
()))
}
if
err
=
tcpConn
.
SetNoDelay
(
conf
.
GettySessionParam
.
TcpNoDelay
);
err
!=
nil
{
return
err
}
if
err
=
tcpConn
.
SetKeepAlive
(
conf
.
GettySessionParam
.
TcpKeepAlive
);
err
!=
nil
{
return
err
}
if
conf
.
GettySessionParam
.
TcpKeepAlive
{
if
err
=
tcpConn
.
SetKeepAlivePeriod
(
conf
.
GettySessionParam
.
keepAlivePeriod
);
err
!=
nil
{
return
err
}
}
if
err
=
tcpConn
.
SetReadBuffer
(
conf
.
GettySessionParam
.
TcpRBufSize
);
err
!=
nil
{
return
err
}
if
err
=
tcpConn
.
SetWriteBuffer
(
conf
.
GettySessionParam
.
TcpWBufSize
);
err
!=
nil
{
return
err
}
}
tcpConn
.
SetReadBuffer
(
conf
.
GettySessionParam
.
TcpRBufSize
)
tcpConn
.
SetWriteBuffer
(
conf
.
GettySessionParam
.
TcpWBufSize
)
session
.
SetName
(
conf
.
GettySessionParam
.
SessionName
)
session
.
SetMaxMsgLen
(
conf
.
GettySessionParam
.
MaxMsgLen
)
...
...
@@ -177,10 +197,8 @@ func (s *Server) newSession(session getty.Session) error {
session
.
SetWriteTimeout
(
conf
.
GettySessionParam
.
tcpWriteTimeout
)
session
.
SetCronPeriod
((
int
)(
conf
.
sessionTimeout
.
Nanoseconds
()
/
1e6
))
session
.
SetWaitTime
(
conf
.
GettySessionParam
.
waitTimeout
)
logger
.
Debugf
(
"app accepts new session:%s
\n
"
,
session
.
Stat
())
logger
.
Debugf
(
"server accepts new session: %s"
,
session
.
Stat
())
session
.
SetTaskPool
(
srvGrpool
)
return
nil
}
...
...
@@ -198,7 +216,6 @@ func (s *Server) Start() {
getty
.
WithServerSslEnabled
(
s
.
conf
.
SSLEnabled
),
getty
.
WithServerTlsConfigBuilder
(
config
.
GetServerTlsConfigBuilder
()),
)
}
else
{
tcpServer
=
getty
.
NewTCPServer
(
getty
.
WithLocalAddress
(
addr
),
...
...
@@ -207,7 +224,6 @@ func (s *Server) Start() {
tcpServer
.
RunEventLoop
(
s
.
newSession
)
logger
.
Debugf
(
"s bind addr{%s} ok!"
,
s
.
addr
)
s
.
tcpServer
=
tcpServer
}
// Stop dubbo server
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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