aboutsummaryrefslogtreecommitdiffstats
path: root/ethereum.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-02-02 23:29:13 +0800
committerobscuren <geffobscura@gmail.com>2014-02-02 23:29:13 +0800
commitae0d4eb7aa644b4c295d7a7cd28c38e92777a52f (patch)
tree6bf731936a7a578eb7b29001a79f6152c85eeef6 /ethereum.go
parentcb8a7d979d1a4b2a32317ee0a77815ec2ea38b9f (diff)
downloadgo-tangerine-ae0d4eb7aa644b4c295d7a7cd28c38e92777a52f.tar
go-tangerine-ae0d4eb7aa644b4c295d7a7cd28c38e92777a52f.tar.gz
go-tangerine-ae0d4eb7aa644b4c295d7a7cd28c38e92777a52f.tar.bz2
go-tangerine-ae0d4eb7aa644b4c295d7a7cd28c38e92777a52f.tar.lz
go-tangerine-ae0d4eb7aa644b4c295d7a7cd28c38e92777a52f.tar.xz
go-tangerine-ae0d4eb7aa644b4c295d7a7cd28c38e92777a52f.tar.zst
go-tangerine-ae0d4eb7aa644b4c295d7a7cd28c38e92777a52f.zip
removed upnp
Diffstat (limited to 'ethereum.go')
-rw-r--r--ethereum.go52
1 files changed, 0 insertions, 52 deletions
diff --git a/ethereum.go b/ethereum.go
index eab40e93d..ae0f2eed0 100644
--- a/ethereum.go
+++ b/ethereum.go
@@ -8,7 +8,6 @@ import (
"github.com/ethereum/ethwire-go"
"log"
"net"
- "strconv"
"sync"
"sync/atomic"
"time"
@@ -45,8 +44,6 @@ type Ethereum struct {
Addr net.Addr
- nat NAT
-
peerMut sync.Mutex
// Capabilities for outgoing peers
@@ -62,12 +59,6 @@ func New(caps Caps) (*Ethereum, error) {
ethutil.Config.Db = db
- nat, err := Discover()
- if err != nil {
- log.Printf("Can't discover upnp: %v", err)
- }
- log.Println(nat)
-
nonce, _ := ethutil.RandomUint64()
ethereum := &Ethereum{
shutdownChan: make(chan bool),
@@ -75,7 +66,6 @@ func New(caps Caps) (*Ethereum, error) {
peers: list.New(),
Nonce: nonce,
serverCaps: caps,
- nat: nat,
}
ethereum.TxPool = ethchain.NewTxPool()
ethereum.TxPool.Speaker = ethereum
@@ -213,46 +203,6 @@ func (s *Ethereum) ReapDeadPeerHandler() {
}
}
-// FIXME
-func (s *Ethereum) upnpUpdateThread() {
- // Go off immediately to prevent code duplication, thereafter we renew
- // lease every 15 minutes.
- timer := time.NewTimer(0 * time.Second)
- lport, _ := strconv.ParseInt("30303", 10, 16)
- first := true
-out:
- for {
- select {
- case <-timer.C:
- listenPort, err := s.nat.AddPortMapping("TCP", int(lport), int(lport), "eth listen port", 20*60)
- if err != nil {
- log.Printf("can't add UPnP port mapping: %v\n", err)
- }
- if first && err == nil {
- externalip, err := s.nat.GetExternalAddress()
- if err != nil {
- log.Printf("UPnP can't get external address: %v\n", err)
- continue out
- }
- // externalip, listenport
- log.Println("Successfully bound via UPnP to", externalip, listenPort)
- first = false
- }
- timer.Reset(time.Minute * 15)
- case <-s.shutdownChan:
- break out
- }
- }
-
- timer.Stop()
-
- if err := s.nat.DeletePortMapping("tcp", int(lport), int(lport)); err != nil {
- log.Printf("unable to remove UPnP port mapping: %v\n", err)
- } else {
- log.Printf("succesfully disestablished UPnP port mapping\n")
- }
-}
-
// Start the ethereum
func (s *Ethereum) Start() {
// Bind to addr and port
@@ -267,8 +217,6 @@ func (s *Ethereum) Start() {
go s.peerHandler(ln)
}
- go s.upnpUpdateThread()
-
// Start the reaping processes
go s.ReapDeadPeerHandler()