Skip to content

Commit

Permalink
Merge pull request #807 from subutai-io/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
crioto authored Apr 9, 2018
2 parents 125807f + 475454b commit 6a2c1cb
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 35 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

## [6.3.1] 04/10/2018

* Draft next version

## [6.3.0] 04/09/2018

* New connection process with multiple endpoints
Expand Down
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ try {
echo git clone [email protected]:optdyn/p2p-packaging.git /c/tmp/p2p-packaging >> c:\\tmp\\p2p-win.do
echo cd /c/tmp/p2p-packaging >> c:\\tmp\\p2p-win.do
echo curl -fsSLk https://eu0.${env.BRANCH_NAME}cdn.subutai.io:8338/kurjun/rest/raw/get?name=p2p.exe -o /c/tmp/p2p-packaging/p2p.exe >> c:\\tmp\\p2p-win.do
echo curl -fsSLk https://eu0.${env.BRANCH_NAME}cdn.subutai.io:8338/kurjun/rest/raw/get?name=tap-windows-9.21.2.exe -o /c/tmp/p2p-packaging/tap-windows-9.21.2.exe >> c:\\tmp\\p2p-win.do
echo curl -fsSLk https://eu0.cdn.subutai.io:8338/kurjun/rest/raw/get?name=tap-windows-9.21.2.exe -o /c/tmp/p2p-packaging/tap-windows-9.21.2.exe >> c:\\tmp\\p2p-win.do
echo /c/tmp/p2p-packaging/upload.sh windows ${env.BRANCH_NAME} /c/tmp/p2p-packaging/windows/P2PInstaller/Release/P2PInstaller.msi > c:\\tmp\\p2p-win-upload.do
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.3.0
6.3.1
2 changes: 1 addition & 1 deletion debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
ptp "github.com/subutai-io/p2p/lib"
)

// Debug prints debug information
// CommandDebug prints debug information
func CommandDebug(restPort int) {
out, err := sendRequest(restPort, "debug", &DaemonArgs{})
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions dht_router.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,13 @@ func (dht *DHTRouter) keepAlive() {
lastPing := time.Now()
dht.lastContact = time.Now()
for {
if time.Since(lastPing) > time.Duration(time.Millisecond*60000) {
if time.Since(lastPing) > time.Duration(time.Millisecond*30000) && time.Since(dht.lastContact) > time.Duration(time.Millisecond*40) {
lastPing = time.Now()
if dht.ping() != nil {
ptp.Log(ptp.Error, "DHT router ping failed")
}
}
if time.Since(dht.lastContact) > time.Duration(time.Millisecond*120000) && dht.running {
if time.Since(dht.lastContact) > time.Duration(time.Millisecond*60000) && dht.running {
ptp.Log(ptp.Warning, "Disconnected from DHT router %s by timeout", dht.addr.String())
dht.handshaked = false
dht.running = false
Expand Down
5 changes: 0 additions & 5 deletions lib/p2p.go
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,6 @@ func (p *PeerToPeer) Run() {
initialRequestSent := false
started := time.Now()
p.Dht.LastUpdate = time.Now()
lastDHCPReport := time.Now()
for {
if p.Shutdown {
// TODO: Do it more safely
Expand All @@ -468,10 +467,6 @@ func (p *PeerToPeer) Run() {
initialRequestSent = true
p.Dht.sendFind()
}
if time.Since(lastDHCPReport) > time.Duration(time.Second*300) {
lastDHCPReport = time.Now()
p.ReportIP(p.Interface.GetIP().String(), p.Interface.GetHardwareAddress().String(), p.Interface.GetName())
}
}
Log(Info, "Shutting down instance %s completed", p.Dht.NetworkHash)
}
Expand Down
29 changes: 4 additions & 25 deletions lib/peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -399,27 +399,6 @@ func (np *NetworkPeer) route(ptpc *PeerToPeer) error {
if len(np.EndpointsHeap) > 0 {
np.Endpoint = np.EndpointsHeap[0].Addr
np.ConnectionAttempts = 0
// } else {
// np.ConnectionAttempts++
// np.LastError = "No more endpoints"
// if time.Since(np.LastFind) > time.Duration(time.Second*90) {
// Log(Debug, "No endpoints and no updates from DHT")
// np.SetState(PeerStateDisconnect, ptpc)
// return nil
// }
// if len(np.KnownIPs) > 0 && len(np.Proxies) > 0 {
// Log(Debug, "We have IPs and Proxies. Syncing states")
// np.SetState(PeerStateWaitingToConnect, ptpc)
// return nil
// } else if len(np.KnownIPs) == 0 {
// Log(Debug, "Don't know any endpoints. Requesting")
// np.SetState(PeerStateRequestedIP, ptpc)
// return nil
// } else if len(np.Proxies) == 0 {
// Log(Debug, "Don't know any proxies. Requesting")
// np.SetState(PeerStateRequestingProxy, ptpc)
// return nil
// }
} else {
Log(Debug, "No active endpoints. Disconnecting peer %s", np.ID)
np.Endpoint = nil
Expand All @@ -435,10 +414,10 @@ func (np *NetworkPeer) stateConnected(ptpc *PeerToPeer) error {
return nil
}

// if time.Since(np.LastPunch) > time.Duration(time.Millisecond*30000) && np.Stat.localNum < 1 && np.Stat.internetNum < 1 {
// Log(Info, "New hole punch activity: Local %d Internet %d", np.Stat.localNum, np.Stat.internetNum)
// go np.punchUDPHole(ptpc)
// }
if time.Since(np.LastPunch) > time.Duration(time.Millisecond*30000) && np.Stat.localNum < 1 && np.Stat.internetNum < 1 {
Log(Info, "New hole punch activity: Local %d Internet %d", np.Stat.localNum, np.Stat.internetNum)
go np.punchUDPHole(ptpc)
}

np.pingEndpoints(ptpc)
np.syncWithRemoteState(ptpc)
Expand Down

0 comments on commit 6a2c1cb

Please sign in to comment.