Skip to content

Commit

Permalink
removed old serverhop redundant logic
Browse files Browse the repository at this point in the history
  • Loading branch information
talkkonnect committed Sep 5, 2021
1 parent 19221c7 commit a0f76c7
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 52 deletions.
15 changes: 4 additions & 11 deletions clientcommands.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,8 @@ func (b *Talkkonnect) Connect() {

if err != nil {
log.Printf("error: Connection Error %v connecting to %v failed, attempting again...", err, b.Address)
if !ServerHop {
log.Println("debug: In the Connect Function & Trying With Username ", Username)
log.Println("debug: DEBUG Serverhop Not Set Reconnecting!!")
b.ReConnect()
}
} else {
b.OpenStream()
log.Println("debug: In the Connect Function & Trying With Username ", Username)
b.ReConnect()
}
}

Expand All @@ -111,10 +106,8 @@ func (b *Talkkonnect) ReConnect() {
}

if ConnectAttempts < 3 {
if !ServerHop {
ConnectAttempts++
b.Connect()
}
ConnectAttempts++
b.Connect()
} else {
if TargetBoard == "rpi" {
if LCDEnabled {
Expand Down
1 change: 0 additions & 1 deletion commandkeys.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,6 @@ func (b *Talkkonnect) cmdQuitTalkkonnect() {
if TTSEnabled && TTSQuitTalkkonnect {
localMediaPlayer(TTSQuitTalkkonnectFilenameAndPath, TTSVolumeLevel, 0, 1)
}
ServerHop = true
b.CleanUp()
}

Expand Down
10 changes: 5 additions & 5 deletions ledstrip.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ import (
)

const (
numLEDs int = 3
numLEDs int = 3
SOnlineLED int = 0
SParticipantsLED int = 1
STransmitLED int = 2
OnlineCol string = "FF0000"
ParticipantsCol string = "00FF00"
TransmitCol string = "0000FF"
OffCol string = "000000"
OnlineCol string = "FF0000"
ParticipantsCol string = "00FF00"
TransmitCol string = "0000FF"
OffCol string = "000000"
)

type LedStrip struct {
Expand Down
14 changes: 5 additions & 9 deletions onevent.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,7 @@ func (b *Talkkonnect) OnConnect(e *gumble.ConnectEvent) {
}

func (b *Talkkonnect) OnDisconnect(e *gumble.DisconnectEvent) {
if !ServerHop {
b.BackLightTimer()
}
b.BackLightTimer()

var reason string

Expand All @@ -114,12 +112,10 @@ func (b *Talkkonnect) OnDisconnect(e *gumble.DisconnectEvent) {
}
}

if !ServerHop {
log.Println("alert: Attempting Reconnect in 10 seconds...")
log.Println("alert: Connection to ", b.Address, "disconnected")
log.Println("alert: Disconnection Reason ", reason)
b.ReConnect()
}
log.Println("alert: Attempting Reconnect in 10 seconds...")
log.Println("alert: Connection to ", b.Address, "disconnected")
log.Println("alert: Disconnection Reason ", reason)
b.ReConnect()

}

Expand Down
24 changes: 0 additions & 24 deletions stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import (
"errors"
"fmt"
"log"
"strconv"
"time"

"github.com/talkkonnect/go-openal/openal"
Expand Down Expand Up @@ -315,29 +314,6 @@ func (s *Stream) playIntoStream(filepath string, vol float32) {
}

func (b *Talkkonnect) OpenStream() {
if ServerHop {
log.Println("debug: Server Hop Requested Will Now Destroy Old Server Stream")
b.Stream.Destroy()
var participantCount = len(b.Client.Self.Channel.Users)

log.Println("info: Current Channel ", b.Client.Self.Channel.Name, " has (", participantCount, ") participants")
b.ListUsers()
if TargetBoard == "rpi" {
if LCDEnabled {
LcdText[0] = b.Address
LcdText[1] = b.Client.Self.Channel.Name + " (" + strconv.Itoa(participantCount) + " Users)"
LcdDisplay(LcdText, LCDRSPin, LCDEPin, LCDD4Pin, LCDD5Pin, LCDD6Pin, LCDD7Pin, LCDInterfaceType, LCDI2CAddress)
}
if OLEDEnabled {
oledDisplay(false, 0, 1, b.Address)
oledDisplay(false, 1, 1, b.Client.Self.Channel.Name+" ("+strconv.Itoa(participantCount)+" Users)")
oledDisplay(false, 6, 1, "Please Visit")
oledDisplay(false, 7, 1, "www.talkkonnect.com")
}

}
}

if stream, err := New(b.Client); err != nil {

if TargetBoard == "rpi" {
Expand Down
3 changes: 1 addition & 2 deletions xmlparser.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ import (

//version and release date
const (
talkkonnectVersion string = "1.68.01"
talkkonnectVersion string = "1.68.02"
talkkonnectReleased string = "Sep 5 2021"
)

Expand All @@ -76,7 +76,6 @@ var (
LcdText = [4]string{"nil", "nil", "nil", "nil"}
ConfigXMLFile string
Streaming bool
ServerHop bool
HTTPServRunning bool
NowStreaming bool
MyLedStrip *LedStrip
Expand Down

0 comments on commit a0f76c7

Please sign in to comment.