Skip to content

Commit

Permalink
Merge pull request #427 from subutai-io/fix-local
Browse files Browse the repository at this point in the history
Fix local
  • Loading branch information
crioto authored Nov 2, 2017
2 parents 49cd868 + 4600dc4 commit 478634c
Show file tree
Hide file tree
Showing 8 changed files with 308 additions and 213 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.1.9
6.1.10
2 changes: 1 addition & 1 deletion instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ type Daemon struct {
SaveFile string
}

func (p *Daemon) Init(saveFile string) {
func (p *Daemon) Initialize(saveFile string) {
p.Instances = new(InstanceList)
p.Instances.Init()
p.SaveFile = saveFile
Expand Down
17 changes: 3 additions & 14 deletions lib/peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,17 +142,6 @@ func (np *NetworkPeer) stateRequestedIP(ptpc *PeerToPeer) error {
np.SetState(PeerStateConnectingDirectlyWait, ptpc)
return nil
}
/*
for _, PeerInfo := range ptpc.Dht.Peers {
if PeerInfo.ID == np.ID {
if len(PeerInfo.Ips) >= 1 {
np.KnownIPs = PeerInfo.Ips
// After we received IP we should wait for other peer to do the same and start to connect directly
np.SetState(PeerStateConnectingDirectlyWait, ptpc)
return nil
}
}
}*/
time.Sleep(100 * time.Millisecond)
}
return nil
Expand Down Expand Up @@ -204,6 +193,7 @@ func (np *NetworkPeer) stateConnectingDirectly(ptpc *PeerToPeer) error {
}
// Try to connect locally
isLocal := np.ProbeLocalConnection(ptpc)

if isLocal {
np.PeerAddr = np.Endpoint
Log(Info, "Connected with %s over LAN", np.ID)
Expand Down Expand Up @@ -520,10 +510,9 @@ func (np *NetworkPeer) ProbeLocalConnection(ptpc *PeerToPeer) bool {
}
for _, kip := range np.KnownIPs {
Log(Debug, "Probing new IP %s against network %s", kip.IP.String(), network.String())

if network.Contains(kip.IP) {

if np.TestConnection(ptpc, kip) {
result := np.holePunch(kip, ptpc)
if result {
np.Endpoint = kip
Log(Info, "Setting endpoint for %s to %s", np.ID, kip.String())
return true
Expand Down
14 changes: 0 additions & 14 deletions lib/platform_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,20 +79,6 @@ func InitPlatform() {
}
}

/*remdev := exec.Command(TAP_TOOL, "")
err := remdev.Run()
if err != nil {
Log(Error, "Failed to remove TUN/TAP Devices: %v", err)
}*/
/*
for i := 0; i < 10; i++ {
adddev := exec.Command(ADD_DEV)
err := adddev.Run()
if err != nil {
Log(Error, "Failed to add TUN/TAP Device: %v", err)
}
}
*/
for i := 0; i < 10; i++ {
key, err := queryNetworkKey()
if err != nil {
Expand Down
Loading

0 comments on commit 478634c

Please sign in to comment.