mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2024-11-27 03:55:18 +00:00
Merge branch 'master' into testing
This commit is contained in:
commit
8c7d514032
2
build
2
build
@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
export GOPATH=$PWD
|
export GOPATH=$PWD
|
||||||
echo "Downloading..."
|
echo "Downloading..."
|
||||||
go get -d -v
|
go get -d -v
|
||||||
|
11
yggdrasil.go
11
yggdrasil.go
@ -9,6 +9,7 @@ import "io/ioutil"
|
|||||||
import "net"
|
import "net"
|
||||||
import "os"
|
import "os"
|
||||||
import "os/signal"
|
import "os/signal"
|
||||||
|
import "syscall"
|
||||||
import "time"
|
import "time"
|
||||||
import "regexp"
|
import "regexp"
|
||||||
|
|
||||||
@ -21,7 +22,7 @@ import "golang.org/x/net/ipv6"
|
|||||||
|
|
||||||
import . "yggdrasil"
|
import . "yggdrasil"
|
||||||
|
|
||||||
import _ "github.com/kardianos/minwinsvc"
|
import "github.com/kardianos/minwinsvc"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a very crude wrapper around src/yggdrasil
|
* This is a very crude wrapper around src/yggdrasil
|
||||||
@ -306,7 +307,13 @@ func main() {
|
|||||||
}
|
}
|
||||||
// Catch interrupt to exit gracefully
|
// Catch interrupt to exit gracefully
|
||||||
c := make(chan os.Signal, 1)
|
c := make(chan os.Signal, 1)
|
||||||
signal.Notify(c, os.Interrupt, os.Kill)
|
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
|
||||||
|
// Create a function to capture the service being stopped on Windows
|
||||||
|
winTerminate := func() {
|
||||||
|
c <- os.Interrupt
|
||||||
|
}
|
||||||
|
minwinsvc.SetOnExit(winTerminate)
|
||||||
|
// Wait for the terminate/interrupt signal
|
||||||
<-c
|
<-c
|
||||||
logger.Println("Stopping...")
|
logger.Println("Stopping...")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user