good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
bor
Commits
ae0d4eb7
Commit
ae0d4eb7
authored
11 years ago
by
Jeffrey Wilcke
Browse files
Options
Downloads
Patches
Plain Diff
removed upnp
parent
cb8a7d97
No related branches found
Branches containing commit
No related tags found
Tags containing commit
Loading
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ethereum.go
+0
-52
0 additions, 52 deletions
ethereum.go
with
0 additions
and
52 deletions
ethereum.go
+
0
−
52
View file @
ae0d4eb7
...
@@ -8,7 +8,6 @@ import (
...
@@ -8,7 +8,6 @@ import (
"github.com/ethereum/ethwire-go"
"github.com/ethereum/ethwire-go"
"log"
"log"
"net"
"net"
"strconv"
"sync"
"sync"
"sync/atomic"
"sync/atomic"
"time"
"time"
...
@@ -45,8 +44,6 @@ type Ethereum struct {
...
@@ -45,8 +44,6 @@ type Ethereum struct {
Addr
net
.
Addr
Addr
net
.
Addr
nat
NAT
peerMut
sync
.
Mutex
peerMut
sync
.
Mutex
// Capabilities for outgoing peers
// Capabilities for outgoing peers
...
@@ -62,12 +59,6 @@ func New(caps Caps) (*Ethereum, error) {
...
@@ -62,12 +59,6 @@ func New(caps Caps) (*Ethereum, error) {
ethutil
.
Config
.
Db
=
db
ethutil
.
Config
.
Db
=
db
nat
,
err
:=
Discover
()
if
err
!=
nil
{
log
.
Printf
(
"Can't discover upnp: %v"
,
err
)
}
log
.
Println
(
nat
)
nonce
,
_
:=
ethutil
.
RandomUint64
()
nonce
,
_
:=
ethutil
.
RandomUint64
()
ethereum
:=
&
Ethereum
{
ethereum
:=
&
Ethereum
{
shutdownChan
:
make
(
chan
bool
),
shutdownChan
:
make
(
chan
bool
),
...
@@ -75,7 +66,6 @@ func New(caps Caps) (*Ethereum, error) {
...
@@ -75,7 +66,6 @@ func New(caps Caps) (*Ethereum, error) {
peers
:
list
.
New
(),
peers
:
list
.
New
(),
Nonce
:
nonce
,
Nonce
:
nonce
,
serverCaps
:
caps
,
serverCaps
:
caps
,
nat
:
nat
,
}
}
ethereum
.
TxPool
=
ethchain
.
NewTxPool
()
ethereum
.
TxPool
=
ethchain
.
NewTxPool
()
ethereum
.
TxPool
.
Speaker
=
ethereum
ethereum
.
TxPool
.
Speaker
=
ethereum
...
@@ -213,46 +203,6 @@ func (s *Ethereum) ReapDeadPeerHandler() {
...
@@ -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
// Start the ethereum
func
(
s
*
Ethereum
)
Start
()
{
func
(
s
*
Ethereum
)
Start
()
{
// Bind to addr and port
// Bind to addr and port
...
@@ -267,8 +217,6 @@ func (s *Ethereum) Start() {
...
@@ -267,8 +217,6 @@ func (s *Ethereum) Start() {
go
s
.
peerHandler
(
ln
)
go
s
.
peerHandler
(
ln
)
}
}
go
s
.
upnpUpdateThread
()
// Start the reaping processes
// Start the reaping processes
go
s
.
ReapDeadPeerHandler
()
go
s
.
ReapDeadPeerHandler
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment