File tree Expand file tree Collapse file tree 3 files changed +34
-1
lines changed Expand file tree Collapse file tree 3 files changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -166,7 +166,7 @@ func (c *Client) loop() {
166
166
c .Debugf ("Connection error: %s" , connerr )
167
167
c .Infof ("Retrying in %s..." , d )
168
168
connerr = nil
169
- time . Sleep (d )
169
+ chshare . SleepSignal (d )
170
170
}
171
171
d := websocket.Dialer {
172
172
ReadBufferSize : 1024 ,
Original file line number Diff line number Diff line change
1
+ //+build !windows
2
+
3
+ package chshare
4
+
5
+ import (
6
+ "os"
7
+ "os/signal"
8
+ "syscall"
9
+ "time"
10
+ )
11
+
12
+ //Sleep unless Signal
13
+ func SleepSignal (d time.Duration ) {
14
+ //during this time, also listen for SIGHUP
15
+ //(this uses 0xc to allow windows to compile)
16
+ sig := make (chan os.Signal , 1 )
17
+ signal .Notify (sig , syscall .SIGHUP )
18
+ select {
19
+ case <- time .After (d ):
20
+ case <- sig :
21
+ }
22
+ signal .Stop (sig )
23
+ }
Original file line number Diff line number Diff line change
1
+ //+build windows
2
+
3
+ package chshare
4
+
5
+ import "time"
6
+
7
+ //Sleep unless Signal
8
+ func SleepSignal (d time.Duration ) {
9
+ time .Sleep (d ) //not supported
10
+ }
You can’t perform that action at this time.
0 commit comments