Not try to create temporary file with enode (#3035)

* Update server.go

* Update server.go
This commit is contained in:
ledgerwatch 2021-11-25 18:36:15 +00:00 committed by GitHub
parent 905818f4e2
commit 14f81db038
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -23,10 +23,7 @@ import (
"encoding/hex"
"errors"
"fmt"
"io/ioutil"
"net"
"os"
"path"
"sort"
"sync"
"sync/atomic"
@ -68,8 +65,6 @@ const (
frameWriteTimeout = 20 * time.Second
)
var EnodeAddressFileName = path.Join(os.TempDir(), "enode_address.tmp")
var errServerStopped = errors.New("server stopped")
// Config holds Server options.
@ -718,12 +713,6 @@ func (srv *Server) doPeerOp(fn peerOpFunc) {
// run is the main loop of the server.
func (srv *Server) run() {
defer debug.LogPanic()
if srv.localnode.Node().TCP() > 0 {
err := ioutil.WriteFile(EnodeAddressFileName, []byte(srv.localnode.Node().URLv4()), 0600)
if err != nil {
srv.log.Error("Write enode to file failed", "self", srv.localnode.Node().URLv4())
}
}
if len(srv.Config.Protocols) > 0 {
srv.log.Info("Started P2P networking", "version", srv.Config.Protocols[0].Version, "self", srv.localnode.Node().URLv4(), "name", srv.Name)
}