Skip to content

Commit 99cabc5

Browse files
authored
Merge pull request #947 from bfenetworks/release/v1.5.0
Release/v1.5.0
2 parents 3ed1851 + 5761205 commit 99cabc5

File tree

9 files changed

+78
-6
lines changed

9 files changed

+78
-6
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,5 @@ coverage.txt
2626
.vscode/*
2727
bfe
2828
dist/*
29+
30+
.DS_Store

bfe_modules/mod_tcp_keepalive/keepalive_darwin.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,7 @@ func setCount(fd int, n int) error {
3636
func setInterval(fd int, secs int) error {
3737
return os.NewSyscallError("setsockopt", syscall.SetsockoptInt(fd, syscall.IPPROTO_TCP, _TCP_KEEPINTVL, secs))
3838
}
39+
40+
func setNonblock(fd int) error {
41+
return os.NewSyscallError("setsockopt", syscall.SetNonblock(fd, true))
42+
}

bfe_modules/mod_tcp_keepalive/keepalive_linux.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,7 @@ func setCount(fd int, n int) error {
3030
func setInterval(fd int, secs int) error {
3131
return os.NewSyscallError("setsockopt", syscall.SetsockoptInt(fd, syscall.IPPROTO_TCP, syscall.TCP_KEEPINTVL, secs))
3232
}
33+
34+
func setNonblock(fd int) error {
35+
return os.NewSyscallError("setsockopt", syscall.SetNonblock(fd, true))
36+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
// Copyright (c) 2021 The BFE Authors.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package mod_tcp_keepalive
16+
17+
import (
18+
"github.com/baidu/go-lib/log"
19+
)
20+
21+
func setIdle(fd int, secs int) error {
22+
if openDebug {
23+
log.Logger.Debug("mod[mod_tcp_keepalive] setIdle not implemented")
24+
}
25+
26+
return nil
27+
}
28+
29+
func setCount(fd int, n int) error {
30+
if openDebug {
31+
log.Logger.Debug("mod[mod_tcp_keepalive] setCount not implemented")
32+
}
33+
34+
return nil
35+
}
36+
37+
func setInterval(fd int, secs int) error {
38+
if openDebug {
39+
log.Logger.Debug("mod[mod_tcp_keepalive] setInterval not implemented")
40+
}
41+
42+
return nil
43+
}
44+
45+
func setNonblock(fd int) error {
46+
if openDebug {
47+
log.Logger.Debug("mod[mod_tcp_keepalive] setNonblock not implemented")
48+
}
49+
50+
return nil
51+
}

bfe_modules/mod_tcp_keepalive/mod_tcp_keepalive.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
"net/url"
2121
"os"
2222
"reflect"
23-
"syscall"
2423

2524
"github.com/baidu/go-lib/log"
2625
"github.com/baidu/go-lib/web-monitor/metrics"
@@ -142,10 +141,6 @@ func (m *ModuleTcpKeepAlive) disableKeepAlive(tcpConn *net.TCPConn) error {
142141
return nil
143142
}
144143

145-
func setNonblock(fd int) error {
146-
return os.NewSyscallError("setsockopt", syscall.SetNonblock(fd, true))
147-
}
148-
149144
func (m *ModuleTcpKeepAlive) setKeepAliveParam(conn *net.TCPConn, p KeepAliveParam) error {
150145
var err error
151146
var f *os.File

conf/bfe.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ ClusterTableConf = cluster_conf/cluster_table.data
4545
GslbConf = cluster_conf/gslb.data
4646

4747
Modules = mod_trust_clientip
48+
# Modules = mod_tcp_keepalive
4849
Modules = mod_block
4950
Modules = mod_header
5051
Modules = mod_rewrite
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[basic]
2-
DataPath = ../data/mod_tcp_keepalive/tcp_keepalive.data
2+
DataPath = mod_tcp_keepalive/tcp_keepalive.data
33

44
[log]
55
OpenDebug = false
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"Config": {
3+
"product1": [
4+
{
5+
"VipConf": ["180.97.93.196"],
6+
"KeepAliveParam": {
7+
"KeepIdle": 270,
8+
"KeepIntvl": 9
9+
}
10+
}
11+
]
12+
},
13+
"Version": "2021-06-25 14:31:05"
14+
}

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ require (
5858
go.elastic.co/apm/module/apmhttp v1.7.2 // indirect
5959
go.elastic.co/fastjson v1.1.0 // indirect
6060
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
61+
golang.org/x/text v0.3.7 // indirect
6162
google.golang.org/grpc v1.22.1 // indirect
6263
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect
6364
howett.net/plist v0.0.0-20181124034731-591f970eefbb // indirect

0 commit comments

Comments
 (0)