Skip to content

Commit

Permalink
Merge pull request etcd-io#14920 from andy-js/andy-js/release-3.5
Browse files Browse the repository at this point in the history
client/pkg/v3: fixes Solaris build of transport
  • Loading branch information
ptabor authored and tjungblu committed Jul 26, 2023
2 parents 02987f7 + a0e8741 commit f0a76d1
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 2 deletions.
35 changes: 35 additions & 0 deletions client/pkg/transport/sockopt_solaris.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Copyright 2021 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 solaris
// +build solaris

package transport

import (
"fmt"
"syscall"

"golang.org/x/sys/unix"
)

func setReusePort(network, address string, c syscall.RawConn) error {
return fmt.Errorf("port reuse is not supported on Solaris")
}

func setReuseAddress(network, address string, conn syscall.RawConn) error {
return conn.Control(func(fd uintptr) {
syscall.SetsockoptInt(int(fd), syscall.SOL_SOCKET, unix.SO_REUSEADDR, 1)
})
}
18 changes: 16 additions & 2 deletions client/pkg/transport/sockopt_unix.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
//go:build !windows
// +build !windows
// Copyright 2021 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 !windows && !solaris
// +build !windows,!solaris

package transport

Expand Down

0 comments on commit f0a76d1

Please sign in to comment.