update
This commit is contained in:
10
TCPServer.go
10
TCPServer.go
@@ -7,6 +7,7 @@ import (
|
||||
"os"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
@@ -29,6 +30,7 @@ type TCPServer struct {
|
||||
CmdChan chan string
|
||||
Log *log.Logger
|
||||
Config *Config
|
||||
MessageSent int
|
||||
}
|
||||
|
||||
func NewTCPServer(address string, port string) *TCPServer {
|
||||
@@ -39,6 +41,7 @@ func NewTCPServer(address string, port string) *TCPServer {
|
||||
MsgChan: make(chan string, 100),
|
||||
CmdChan: make(chan string),
|
||||
Mutex: new(sync.Mutex),
|
||||
MessageSent: 0,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,10 +123,17 @@ func (s *TCPServer) Write(message string) (n int, err error) {
|
||||
func (s *TCPServer) broadcastMessage(message string) {
|
||||
s.Mutex.Lock()
|
||||
defer s.Mutex.Unlock()
|
||||
if len(s.Clients) > 0 {
|
||||
if s.MessageSent == 0 {
|
||||
time.Sleep(3 * time.Second)
|
||||
s.MessageSent += 1
|
||||
}
|
||||
for client := range s.Clients {
|
||||
_, err := client.Write([]byte(message + "\r\n"))
|
||||
s.MessageSent += 1
|
||||
if err != nil {
|
||||
fmt.Println("Error while sending message to clients:", client.RemoteAddr())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -26,8 +26,8 @@ cluster:
|
||||
command: "SET/NOFILTER" #"SET/FILTER DOC/PASS EA,OH,G,F,DL,I,SV,9A,SK,S5,LX,OE,HA,CT"
|
||||
login_prompt: "login:"
|
||||
flex:
|
||||
discovery: true # Radio must be on same LAN than the program
|
||||
ip: 192.168.2.131 # if discovery is true no need to put an IP
|
||||
discovery: false # Radio must be on same LAN than the program
|
||||
ip: 82.67.157.19 # if discovery is true no need to put an IP
|
||||
spot_life: 600 #seconds
|
||||
telnetserver: # Log4OM must be connected to this server ie: localhost:7301 if on same machine as this program else ip:7301
|
||||
host: 0.0.0.0
|
||||
|
@@ -20,7 +20,7 @@ func Gotify(spot FlexSpot) {
|
||||
|
||||
if Cfg.Gotify.Enable && !strings.Contains(ExceptionList, spot.DX) {
|
||||
|
||||
message := fmt.Sprintf("DX: %s\nFrom: %s\nFreq: %s\nMode: %s\nTime: %s\n", spot.DX, spot.SpotterCallsign, spot.FrequencyMhz, spot.Mode, spot.TimeStamp)
|
||||
message := fmt.Sprintf("DX: %s\nFrom: %s\nFreq: %s\nMode: %s\nTime: %v\n", spot.DX, spot.SpotterCallsign, spot.FrequencyMhz, spot.Mode, spot.TimeStamp)
|
||||
|
||||
gotifyMsg := GotifyMessage{
|
||||
Title: "",
|
||||
|
BIN
images/FlexDXCluster.ico
Normal file
BIN
images/FlexDXCluster.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 202 KiB |
BIN
images/background.jpg
Normal file
BIN
images/background.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.2 MiB |
Reference in New Issue
Block a user