Skip to content

Commit 6ee8b5c

Browse files
committed
Keeping connected to peerbook
1 parent cf93459 commit 6ee8b5c

File tree

4 files changed

+13
-4
lines changed

4 files changed

+13
-4
lines changed

CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ Known issues:
1515

1616
### Fixed
1717

18-
- removing a hidden loop taht cause webexec to hang
18+
- forever trying to reconnect to peerbook
19+
- removing a hidden loop that could cause webexec to hang
1920

2021

2122
## [0.10.5] - 2021-4-25

conf.go

+8
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ disconnect = 3000
3333
failed = 6000
3434
keep_alive = 500
3535
ice_gathering = 5000
36+
peerbook = 3000
3637
[env]
3738
COLORTERM = "truecolor"
3839
TERM = "xterm"
@@ -48,6 +49,7 @@ var Conf struct {
4849
failedTimeout time.Duration
4950
keepAliveInterval time.Duration
5051
gatheringTimeout time.Duration
52+
peerbookTimeout time.Duration
5153
iceServers []string
5254
httpServer string
5355
logFilePath string
@@ -108,6 +110,12 @@ func parseConf(s string) error {
108110
} else {
109111
Conf.gatheringTimeout = 3 * time.Second
110112
}
113+
v = t.Get("timeouts.peerbook")
114+
if v != nil {
115+
Conf.peerbookTimeout = time.Duration(v.(int64)) * time.Millisecond
116+
} else {
117+
Conf.peerbookTimeout = 3 * time.Second
118+
}
111119
v = t.Get("net.ice_servers")
112120
if v != nil {
113121
urls := v.([]interface{})

docs/conf.md

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ All values are in Milliseconds
2929
- failed: the failed timeout, default: 6000
3030
- keep_alive: how long to wait between keep alive messages, default 500
3131
- ice_gathering: gathering timeout, default 5000
32+
- peerbook: how long to wait before peerbook reconnnect, default 3000
3233

3334
### env
3435

signaling.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import (
1717
var wsWriteM sync.Mutex
1818

1919
func signalingGo() {
20-
start:
2120
c, err := dialWS()
2221
if err != nil {
2322
Logger.Errorf("Failed to dial the signaling server: %q", err)
@@ -29,8 +28,7 @@ start:
2928
mType, m, err := c.ReadMessage()
3029
if err != nil {
3130
Logger.Errorf("Signaling read error", err)
32-
c.Close()
33-
goto start
31+
break
3432
}
3533
if mType == websocket.TextMessage {
3634
Logger.Info("Received text message", string(m))
@@ -40,6 +38,7 @@ start:
4038
}
4139
}
4240
}
41+
time.AfterFunc(Conf.peerbookTimeout, signalingGo)
4342
}
4443
func getFP() string {
4544
certs, err := GetCerts()

0 commit comments

Comments
 (0)