aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Borg <jakob@nym.se>2014-09-06 06:49:51 +0200
committerJakob Borg <jakob@nym.se>2014-09-06 06:49:51 +0200
commit5b51f4d058c306d04cbb81dd87846e7b6d6ed55e (patch)
treefc76e7bd654a957ff2ecf011cd400facb0c598d6
parent97cb3fa5a52764b45cfaa27a2814dc6169e6455e (diff)
downloadsyncthing-5b51f4d058c306d04cbb81dd87846e7b6d6ed55e.tar.gz
syncthing-5b51f4d058c306d04cbb81dd87846e7b6d6ed55e.zip
Revert "Proper signal handling in monitor process"
This reverts commit 33e9a88b56395130873a4052381baa7d90486779.
-rw-r--r--cmd/syncthing/monitor.go25
-rwxr-xr-xintegration/all.sh2
-rw-r--r--integration/common_test.go7
-rw-r--r--integration/reconnect_test.go17
4 files changed, 12 insertions, 39 deletions
diff --git a/cmd/syncthing/monitor.go b/cmd/syncthing/monitor.go
index 0c07fbed1..0f3cbf2ce 100644
--- a/cmd/syncthing/monitor.go
+++ b/cmd/syncthing/monitor.go
@@ -9,11 +9,9 @@ import (
"io"
"os"
"os/exec"
- "os/signal"
"path/filepath"
"strings"
"sync"
- "syscall"
"time"
)
@@ -35,10 +33,6 @@ func monitorMain() {
args := os.Args
var restarts [countRestarts]time.Time
- sign := make(chan os.Signal, 1)
- sigTerm := syscall.Signal(0xf)
- signal.Notify(sign, os.Interrupt, sigTerm, os.Kill)
-
for {
if t := time.Since(restarts[0]); t < loopThreshold {
l.Warnf("%d restarts in %v; not retrying further", countRestarts, t)
@@ -74,23 +68,10 @@ func monitorMain() {
go copyStderr(stderr)
go copyStdout(stdout)
- exit := make(chan error)
-
- go func() {
- exit <- cmd.Wait()
- }()
-
- select {
- case s := <-sign:
- l.Infof("Signal %d received; exiting", s)
- cmd.Process.Kill()
- <-exit
+ err = cmd.Wait()
+ if err == nil {
+ // Successfull exit indicates an intentional shutdown
return
- case <-exit:
- if err == nil {
- // Successfull exit indicates an intentional shutdown
- return
- }
}
l.Infoln("Syncthing exited:", err)
diff --git a/integration/all.sh b/integration/all.sh
index d7945ac24..809b3e45b 100755
--- a/integration/all.sh
+++ b/integration/all.sh
@@ -2,7 +2,7 @@
set -euo pipefail
IFS=$'\n\t'
+#go test -tags integration -v
./test-http.sh
./test-merge.sh
./test-delupd.sh
-go test -tags integration -v
diff --git a/integration/common_test.go b/integration/common_test.go
index eda0ec537..0b7244e00 100644
--- a/integration/common_test.go
+++ b/integration/common_test.go
@@ -19,7 +19,6 @@ import (
"os"
"os/exec"
"path/filepath"
- "runtime"
"time"
)
@@ -55,11 +54,7 @@ func (p *syncthingProcess) start() error {
}
func (p *syncthingProcess) stop() {
- if runtime.GOOS != "windows" {
- p.cmd.Process.Signal(os.Interrupt)
- } else {
- p.cmd.Process.Kill()
- }
+ p.cmd.Process.Kill()
p.cmd.Wait()
}
diff --git a/integration/reconnect_test.go b/integration/reconnect_test.go
index 480ec195e..77b14163c 100644
--- a/integration/reconnect_test.go
+++ b/integration/reconnect_test.go
@@ -24,6 +24,13 @@ var env = []string{
"STTRACE=model",
}
+func TestRestartBothDuringTransfer(t *testing.T) {
+ // Give the receiver some time to rot with needed files but
+ // without any peer. This triggers
+ // https://github.com/syncthing/syncthing/issues/463
+ testRestartDuringTransfer(t, true, true, 10*time.Second, 0)
+}
+
func TestRestartReceiverDuringTransfer(t *testing.T) {
testRestartDuringTransfer(t, false, true, 0, 0)
}
@@ -32,13 +39,6 @@ func TestRestartSenderDuringTransfer(t *testing.T) {
testRestartDuringTransfer(t, true, false, 0, 0)
}
-func TestRestartSenderAndReceiverDuringTransfer(t *testing.T) {
- // // Give the receiver some time to rot with needed files but
- // // without any peer. This triggers
- // // https://github.com/syncthing/syncthing/issues/463
- testRestartDuringTransfer(t, true, true, 10*time.Second, 0)
-}
-
func testRestartDuringTransfer(t *testing.T, restartSender, restartReceiver bool, senderDelay, receiverDelay time.Duration) {
log.Println("Cleaning...")
err := removeAll("s1", "s2", "f1/index", "f2/index")
@@ -134,9 +134,6 @@ func testRestartDuringTransfer(t *testing.T, restartSender, restartReceiver bool
time.Sleep(1 * time.Second)
}
- sender.stop()
- receiver.stop()
-
log.Println("Comparing directories...")
err = compareDirectories("s1", "s2")
if err != nil {