mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 11:41:19 +00:00
Not try to create temporary file with enode (#3035)
* Update server.go * Update server.go
This commit is contained in:
parent
905818f4e2
commit
14f81db038
@ -23,10 +23,7 @@ import (
|
|||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"net"
|
"net"
|
||||||
"os"
|
|
||||||
"path"
|
|
||||||
"sort"
|
"sort"
|
||||||
"sync"
|
"sync"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
@ -68,8 +65,6 @@ const (
|
|||||||
frameWriteTimeout = 20 * time.Second
|
frameWriteTimeout = 20 * time.Second
|
||||||
)
|
)
|
||||||
|
|
||||||
var EnodeAddressFileName = path.Join(os.TempDir(), "enode_address.tmp")
|
|
||||||
|
|
||||||
var errServerStopped = errors.New("server stopped")
|
var errServerStopped = errors.New("server stopped")
|
||||||
|
|
||||||
// Config holds Server options.
|
// Config holds Server options.
|
||||||
@ -718,12 +713,6 @@ func (srv *Server) doPeerOp(fn peerOpFunc) {
|
|||||||
// run is the main loop of the server.
|
// run is the main loop of the server.
|
||||||
func (srv *Server) run() {
|
func (srv *Server) run() {
|
||||||
defer debug.LogPanic()
|
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 {
|
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)
|
srv.log.Info("Started P2P networking", "version", srv.Config.Protocols[0].Version, "self", srv.localnode.Node().URLv4(), "name", srv.Name)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user