Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
ae0d4eb7
Commit
ae0d4eb7
authored
Feb 02, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed upnp
parent
cb8a7d97
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
52 deletions
+0
-52
ethereum.go
ethereum.go
+0
-52
No files found.
ethereum.go
View file @
ae0d4eb7
...
...
@@ -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
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment