up
This commit is contained in:
49
flexradio.go
49
flexradio.go
@ -38,31 +38,29 @@ type FlexSpot struct {
|
||||
}
|
||||
|
||||
type FlexClient struct {
|
||||
Address string
|
||||
Port string
|
||||
Timeout time.Duration
|
||||
LogWriter *bufio.Writer
|
||||
Reader *bufio.Reader
|
||||
Writer *bufio.Writer
|
||||
Conn *net.TCPConn
|
||||
SpotChan chan TelnetSpot
|
||||
MsgChan chan string
|
||||
FlexSpotChan chan FlexSpot
|
||||
Repo FlexDXClusterRepository
|
||||
TCPServer *TCPServer
|
||||
IsConnected bool
|
||||
Address string
|
||||
Port string
|
||||
Timeout time.Duration
|
||||
LogWriter *bufio.Writer
|
||||
Reader *bufio.Reader
|
||||
Writer *bufio.Writer
|
||||
Conn *net.TCPConn
|
||||
SpotChanToFlex chan TelnetSpot
|
||||
MsgChan chan string
|
||||
Repo FlexDXClusterRepository
|
||||
TCPServer *TCPServer
|
||||
IsConnected bool
|
||||
}
|
||||
|
||||
func NewFlexClient(repo FlexDXClusterRepository, TCPServer *TCPServer) *FlexClient {
|
||||
func NewFlexClient(repo FlexDXClusterRepository, TCPServer *TCPServer, SpotChanToFlex chan TelnetSpot) *FlexClient {
|
||||
return &FlexClient{
|
||||
Address: Cfg.Flex.IP,
|
||||
Port: "4992",
|
||||
SpotChan: make(chan TelnetSpot, 100),
|
||||
FlexSpotChan: make(chan FlexSpot, 100),
|
||||
MsgChan: TCPServer.MsgChan,
|
||||
Repo: repo,
|
||||
TCPServer: TCPServer,
|
||||
IsConnected: false,
|
||||
Address: Cfg.Flex.IP,
|
||||
Port: "4992",
|
||||
SpotChanToFlex: SpotChanToFlex,
|
||||
MsgChan: TCPServer.MsgChan,
|
||||
Repo: repo,
|
||||
TCPServer: TCPServer,
|
||||
IsConnected: false,
|
||||
}
|
||||
}
|
||||
|
||||
@ -91,7 +89,7 @@ func (fc *FlexClient) StartFlexClient() {
|
||||
fc.IsConnected = true
|
||||
|
||||
go func() {
|
||||
for message := range fc.SpotChan {
|
||||
for message := range fc.SpotChanToFlex {
|
||||
fc.SendSpottoFlex(message)
|
||||
}
|
||||
}()
|
||||
@ -188,11 +186,6 @@ func (fc *FlexClient) SendSpottoFlex(spot TelnetSpot) {
|
||||
Log.Debugf("could not find the DX in the database: ", err)
|
||||
}
|
||||
|
||||
// send FlexSpot to HTTP Server
|
||||
if Cfg.General.HTTPServer {
|
||||
fc.FlexSpotChan <- flexSpot
|
||||
}
|
||||
|
||||
var stringSpot string
|
||||
if srcFlexSpot.DX == "" {
|
||||
fc.Repo.CreateSpot(flexSpot)
|
||||
|
Reference in New Issue
Block a user