accounts, p2p, rpc: make CGO_ENABLED=0 build again (#19593)
* p2p: remove direct import of cgo-library * accounts, rpc: more nocgo alternatives * rpc: move unix path constant into separate file * accounts/scwallet: address review concerns, remove copy-pasta
This commit is contained in:
committed by
Péter Szilágyi
parent
9efc1a847e
commit
fec3b56f7f
@ -1,4 +1,4 @@
|
||||
// Copyright 2015 The go-ethereum Authors
|
||||
// Copyright 2019 The go-ethereum Authors
|
||||
// This file is part of the go-ethereum library.
|
||||
//
|
||||
// The go-ethereum library is free software: you can redistribute it and/or modify
|
||||
@ -28,20 +28,10 @@ import (
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
)
|
||||
|
||||
/*
|
||||
#include <sys/un.h>
|
||||
|
||||
int max_socket_path_size() {
|
||||
struct sockaddr_un s;
|
||||
return sizeof(s.sun_path);
|
||||
}
|
||||
*/
|
||||
import "C"
|
||||
|
||||
// ipcListen will create a Unix socket on the given endpoint.
|
||||
func ipcListen(endpoint string) (net.Listener, error) {
|
||||
if len(endpoint) > int(C.max_socket_path_size()) {
|
||||
log.Warn(fmt.Sprintf("The ipc endpoint is longer than %d characters. ", C.max_socket_path_size()),
|
||||
if len(endpoint) > int(max_path_size) {
|
||||
log.Warn(fmt.Sprintf("The ipc endpoint is longer than %d characters. ", max_path_size),
|
||||
"endpoint", endpoint)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user