Skip to content

Commit a044af0

Browse files
author
chenjie
committed
update
1 parent 19287cc commit a044af0

File tree

11 files changed

+0
-123
lines changed

11 files changed

+0
-123
lines changed

cgrpc/client.go

-16
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ type ClientConfig struct {
3838
ConnectTimeout time.Duration
3939
GlobalTimeout time.Duration //global timeout for every rpc call
4040
HeartPorbe time.Duration
41-
SocketRBuf uint32
42-
SocketWBuf uint32
4341
MaxMsgLen uint32
4442
UseTLS bool //grpc or grpcs
4543
SkipVerifyTLS bool //don't verify the server's cert
@@ -58,18 +56,6 @@ func (c *ClientConfig) validate() {
5856
if c.HeartPorbe < time.Second {
5957
c.HeartPorbe = 1500 * time.Millisecond
6058
}
61-
if c.SocketRBuf == 0 {
62-
c.SocketRBuf = 1024
63-
}
64-
if c.SocketRBuf > 65535 {
65-
c.SocketRBuf = 65535
66-
}
67-
if c.SocketWBuf == 0 {
68-
c.SocketWBuf = 1024
69-
}
70-
if c.SocketWBuf > 65535 {
71-
c.SocketWBuf = 65535
72-
}
7359
if c.MaxMsgLen < 1024 {
7460
c.MaxMsgLen = 65535
7561
}
@@ -135,8 +121,6 @@ func NewCGrpcClient(c *ClientConfig, selfgroup, selfname, servergroup, servernam
135121
RootCAs: certpool,
136122
})))
137123
}
138-
opts = append(opts, grpc.WithReadBufferSize(int(c.SocketRBuf)))
139-
opts = append(opts, grpc.WithWriteBufferSize(int(c.SocketWBuf)))
140124
opts = append(opts, grpc.WithConnectParams(grpc.ConnectParams{
141125
MinConnectTimeout: c.ConnectTimeout,
142126
Backoff: backoff.Config{

cgrpc/server.go

-16
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ type ServerConfig struct {
3535
ConnectTimeout time.Duration
3636
GlobalTimeout time.Duration //global timeout for every rpc call(including connection establish time)
3737
HeartPorbe time.Duration
38-
SocketRBuf uint32
39-
SocketWBuf uint32
4038
MaxMsgLen uint32
4139
CertKeys map[string]string //mapkey: cert path,mapvalue: key path
4240
}
@@ -51,18 +49,6 @@ func (c *ServerConfig) validate() {
5149
if c.HeartPorbe < time.Second {
5250
c.HeartPorbe = 1500 * time.Millisecond
5351
}
54-
if c.SocketRBuf == 0 {
55-
c.SocketRBuf = 1024
56-
}
57-
if c.SocketRBuf > 65535 {
58-
c.SocketRBuf = 65535
59-
}
60-
if c.SocketWBuf == 0 {
61-
c.SocketWBuf = 1024
62-
}
63-
if c.SocketWBuf > 65535 {
64-
c.SocketWBuf = 65535
65-
}
6652
if c.MaxMsgLen < 1024 {
6753
c.MaxMsgLen = 65535
6854
}
@@ -103,8 +89,6 @@ func NewCGrpcServer(c *ServerConfig, selfgroup, selfname string) (*CGrpcServer,
10389
}
10490
opts := make([]grpc.ServerOption, 0, 6)
10591
opts = append(opts, grpc.StatsHandler(serverinstance))
106-
opts = append(opts, grpc.ReadBufferSize(int(c.SocketRBuf)))
107-
opts = append(opts, grpc.WriteBufferSize(int(c.SocketWBuf)))
10892
opts = append(opts, grpc.MaxRecvMsgSize(int(c.MaxMsgLen)))
10993
opts = append(opts, grpc.MaxSendMsgSize(int(c.MaxMsgLen)))
11094
if c.ConnectTimeout != 0 {

codegen/tml/server/xcrpc/template_xcrpc.go

-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ func StartCrpcServer() {
3030
ConnectTimeout: time.Duration(c.ConnectTimeout),
3131
GlobalTimeout: time.Duration(c.GlobalTimeout),
3232
HeartPorbe: time.Duration(c.HeartProbe),
33-
SocketRBuf: 2048,
34-
SocketWBuf: 2048,
3533
MaxMsgLen: 65535,
3634
}
3735
var e error

codegen/tml/server/xgrpc/template_xgrpc.go

-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ func StartCGrpcServer() {
3030
ConnectTimeout: time.Duration(c.ConnectTimeout),
3131
GlobalTimeout: time.Duration(c.GlobalTimeout),
3232
HeartPorbe: time.Duration(c.HeartProbe),
33-
SocketRBuf: 2048,
34-
SocketWBuf: 2048,
3533
MaxMsgLen: 65535,
3634
}
3735
var e error

codegen/tml/server/xweb/template_xweb.go

-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ func StartWebServer() {
3434
HeartProbe: time.Duration(c.HeartProbe),
3535
StaticFileRootPath: c.StaticFilePath,
3636
MaxHeader: 1024,
37-
SocketRBuf: 2048,
38-
SocketWBuf: 2048,
3937
}
4038
if c.Cors != nil {
4139
webc.Cors = &web.CorsConfig{

crpc/client.go

-16
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ type ClientConfig struct {
3030
ConnectTimeout time.Duration //default 500ms
3131
GlobalTimeout time.Duration //global timeout for every rpc call
3232
HeartPorbe time.Duration //default 1s,3 probe missing means disconnect
33-
SocketRBuf uint32
34-
SocketWBuf uint32
3533
MaxMsgLen uint32
3634
UseTLS bool //crpc or crpcs
3735
SkipVerifyTLS bool //don't verify the server's cert
@@ -50,18 +48,6 @@ func (c *ClientConfig) validate() {
5048
if c.HeartPorbe <= 0 {
5149
c.HeartPorbe = time.Second
5250
}
53-
if c.SocketRBuf == 0 {
54-
c.SocketRBuf = 1024
55-
}
56-
if c.SocketRBuf > 65535 {
57-
c.SocketRBuf = 65535
58-
}
59-
if c.SocketWBuf == 0 {
60-
c.SocketWBuf = 1024
61-
}
62-
if c.SocketWBuf > 65535 {
63-
c.SocketWBuf = 65535
64-
}
6551
if c.MaxMsgLen < 1024 {
6652
c.MaxMsgLen = 65535
6753
}
@@ -130,8 +116,6 @@ func NewCrpcClient(c *ClientConfig, selfgroup, selfname, servergroup, servername
130116
HeartprobeInterval: c.HeartPorbe,
131117
TcpC: &stream.TcpConfig{
132118
ConnectTimeout: c.ConnectTimeout,
133-
SocketRBufLen: c.SocketRBuf,
134-
SocketWBufLen: c.SocketWBuf,
135119
MaxMsgLen: c.MaxMsgLen,
136120
},
137121
}

crpc/server.go

-16
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ type ServerConfig struct {
3131
ConnectTimeout time.Duration
3232
GlobalTimeout time.Duration //global timeout for every rpc call
3333
HeartPorbe time.Duration //default 1s,3 probe missing means disconnect
34-
SocketRBuf uint32
35-
SocketWBuf uint32
3634
MaxMsgLen uint32
3735
CertKeys map[string]string //mapkey: cert path,mapvalue: key path
3836
}
@@ -47,18 +45,6 @@ func (c *ServerConfig) validate() {
4745
if c.HeartPorbe < time.Second {
4846
c.HeartPorbe = time.Second
4947
}
50-
if c.SocketRBuf == 0 {
51-
c.SocketRBuf = 1024
52-
}
53-
if c.SocketRBuf > 65535 {
54-
c.SocketRBuf = 65535
55-
}
56-
if c.SocketWBuf == 0 {
57-
c.SocketWBuf = 1024
58-
}
59-
if c.SocketWBuf > 65535 {
60-
c.SocketWBuf = 65535
61-
}
6248
if c.MaxMsgLen < 1024 {
6349
c.MaxMsgLen = 65535
6450
}
@@ -117,8 +103,6 @@ func NewCrpcServer(c *ServerConfig, selfgroup, selfname string) (*CrpcServer, er
117103
HeartprobeInterval: c.HeartPorbe,
118104
TcpC: &stream.TcpConfig{
119105
ConnectTimeout: c.ConnectTimeout,
120-
SocketRBufLen: c.SocketRBuf,
121-
SocketWBufLen: c.SocketWBuf,
122106
MaxMsgLen: c.MaxMsgLen,
123107
},
124108
}

stream/config.go

-17
Original file line numberDiff line numberDiff line change
@@ -46,35 +46,18 @@ type TcpConfig struct {
4646
//include connect time and verify time
4747
ConnectTimeout time.Duration //default 500ms
4848

49-
SocketRBufLen uint32 //default 1024 byte,max 65535 byte
50-
SocketWBufLen uint32 //default 1024 byte,max 65535 byte
51-
5249
MaxMsgLen uint32 //min 1024,max 65535,default is max
5350
}
5451

5552
var defaultTcpConfig = &TcpConfig{
5653
ConnectTimeout: 500 * time.Millisecond,
57-
SocketRBufLen: 1024,
58-
SocketWBufLen: 1024,
5954
MaxMsgLen: 65535,
6055
}
6156

6257
func (c *TcpConfig) validate() {
6358
if c.ConnectTimeout <= 0 {
6459
c.ConnectTimeout = 500 * time.Millisecond
6560
}
66-
if c.SocketRBufLen == 0 {
67-
c.SocketRBufLen = 1024
68-
}
69-
if c.SocketRBufLen > 65535 {
70-
c.SocketRBufLen = 65535
71-
}
72-
if c.SocketWBufLen == 0 {
73-
c.SocketWBufLen = 1024
74-
}
75-
if c.SocketWBufLen > 65535 {
76-
c.SocketWBufLen = 65535
77-
}
7861
if c.MaxMsgLen < 1024 {
7962
c.MaxMsgLen = 65535
8063
}

stream/conn.go

-4
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@ func (this *Instance) StartTcpServer(listenaddr string, tlsc *tls.Config) error
6363
//disable system's keep alive probe
6464
//use self's heartbeat probe
6565
conn.SetKeepAlive(false)
66-
conn.SetReadBuffer(int(this.c.TcpC.SocketRBufLen))
67-
conn.SetWriteBuffer(int(this.c.TcpC.SocketWBufLen))
6866
if tlsc != nil {
6967
p.conn = tls.Server(conn, tlsc)
7068
p.tls = true
@@ -148,8 +146,6 @@ func (this *Instance) StartTcpClient(serveraddr string, verifydata []byte, tlsc
148146
//disable system's keep alive probe
149147
//use self's heartbeat probe
150148
(conn.(*net.TCPConn)).SetKeepAlive(false)
151-
(conn.(*net.TCPConn)).SetReadBuffer(int(this.c.TcpC.SocketRBufLen))
152-
(conn.(*net.TCPConn)).SetWriteBuffer(int(this.c.TcpC.SocketWBufLen))
153149
p := newPeer(this.c.TcpC.MaxMsgLen)
154150
if tlsc != nil {
155151
p.conn = tls.Client(conn, tlsc)

web/client.go

-16
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ type ClientConfig struct {
3030
//if this is 0,means useless,connection will keep alive until it is closed
3131
IdleTimeout time.Duration
3232
MaxHeader uint
33-
SocketRBuf uint
34-
SocketWBuf uint
3533
SkipVerifyTLS bool //don't verify the server's cert
3634
CAs []string //CAs' path,specific the CAs need to be used,this will overwrite the default behavior:use the system's certpool
3735
}
@@ -51,18 +49,6 @@ func (c *ClientConfig) validate() {
5149
if c.MaxHeader > 65535 {
5250
c.MaxHeader = 65535
5351
}
54-
if c.SocketRBuf == 0 {
55-
c.SocketRBuf = 1024
56-
}
57-
if c.SocketRBuf > 65535 {
58-
c.SocketRBuf = 65535
59-
}
60-
if c.SocketWBuf == 0 {
61-
c.SocketWBuf = 1024
62-
}
63-
if c.SocketWBuf > 65535 {
64-
c.SocketWBuf = 65535
65-
}
6652
}
6753

6854
type WebClient struct {
@@ -113,8 +99,6 @@ func NewWebClient(c *ClientConfig, selfgroup, selfname, servergroup, servername
11399
MaxIdleConnsPerHost: 50,
114100
IdleConnTimeout: c.IdleTimeout,
115101
MaxResponseHeaderBytes: int64(c.MaxHeader),
116-
ReadBufferSize: int(c.SocketRBuf),
117-
WriteBufferSize: int(c.SocketWBuf),
118102
}
119103
if c.HeartProbe < 0 {
120104
transport.DisableKeepAlives = true

web/server.go

-16
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ type ServerConfig struct {
4343
HeartProbe time.Duration //system's tcp keep alive probe interval,'< 0' disable keep alive,'= 0' will be set to default 15s,min is 1s
4444
StaticFileRootPath string
4545
MaxHeader uint
46-
SocketRBuf uint
47-
SocketWBuf uint
4846
CertKeys map[string]string //mapkey: cert path,mapvalue: key path
4947
Cors *CorsConfig
5048
}
@@ -91,18 +89,6 @@ func (c *ServerConfig) validate() {
9189
if c.MaxHeader > 65535 {
9290
c.MaxHeader = 65535
9391
}
94-
if c.SocketRBuf == 0 {
95-
c.SocketRBuf = 1024
96-
}
97-
if c.SocketRBuf > 65535 {
98-
c.SocketRBuf = 65535
99-
}
100-
if c.SocketWBuf == 0 {
101-
c.SocketWBuf = 1024
102-
}
103-
if c.SocketWBuf > 65535 {
104-
c.SocketWBuf = 65535
105-
}
10692
for _, v := range c.Cors.AllowedOrigin {
10793
if v == "*" {
10894
c.Cors.allorigin = true
@@ -200,8 +186,6 @@ func NewWebServer(c *ServerConfig, selfgroup, selfname string) (*WebServer, erro
200186
(conn.(*net.TCPConn)).SetKeepAlive(true)
201187
(conn.(*net.TCPConn)).SetKeepAlivePeriod(c.HeartProbe)
202188
}
203-
(conn.(*net.TCPConn)).SetReadBuffer(int(c.SocketRBuf))
204-
(conn.(*net.TCPConn)).SetWriteBuffer(int(c.SocketWBuf))
205189
return ctx
206190
},
207191
},

0 commit comments

Comments
 (0)