Skip to content

Commit

Permalink
Merge pull request etcd-io#15812 from tangruize/main
Browse files Browse the repository at this point in the history
etcd: ignore SetKeepAlivePeriod errors on OpenBSD
  • Loading branch information
ahrtr authored Feb 6, 2024
2 parents 15aae5b + a00ec2e commit cf70433
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 5 deletions.
5 changes: 0 additions & 5 deletions client/pkg/transport/keepalive_listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,6 @@ func (l *keepAliveConn) SetKeepAlive(doKeepAlive bool) error {
return l.TCPConn.SetKeepAlive(doKeepAlive)
}

// SetKeepAlivePeriod sets keepalive period
func (l *keepAliveConn) SetKeepAlivePeriod(d time.Duration) error {
return l.TCPConn.SetKeepAlivePeriod(d)
}

// A tlsKeepaliveListener implements a network listener (net.Listener) for TLS connections.
type tlsKeepaliveListener struct {
net.Listener
Expand Down
26 changes: 26 additions & 0 deletions client/pkg/transport/keepalive_listener_openbsd.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright 2023 The etcd Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build openbsd

package transport

import "time"

// SetKeepAlivePeriod sets keepalive period
func (l *keepAliveConn) SetKeepAlivePeriod(d time.Duration) error {
// OpenBSD has no user-settable per-socket TCP keepalive options.
// Refer to https://github.com/etcd-io/etcd/issues/15811.
return nil
}
24 changes: 24 additions & 0 deletions client/pkg/transport/keepalive_listener_unix.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright 2023 The etcd Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build !openbsd

package transport

import "time"

// SetKeepAlivePeriod sets keepalive period
func (l *keepAliveConn) SetKeepAlivePeriod(d time.Duration) error {
return l.TCPConn.SetKeepAlivePeriod(d)
}

0 comments on commit cf70433

Please sign in to comment.