Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
martinhpedersen committed Dec 30, 2024
1 parent 5f2e538 commit cf8d587
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
6 changes: 3 additions & 3 deletions http.go
Original file line number Diff line number Diff line change
Expand Up @@ -448,15 +448,15 @@ func bandwidthsHandler(w http.ResponseWriter, req *http.Request) {
}
mode := strings.ToLower(req.FormValue("mode"))
resp := BandwidthResponse{Mode: mode, Bandwidths: []string{}}
switch {
case mode == MethodArdop:
switch mode {
case MethodArdop:
for _, bw := range ardop.Bandwidths() {
resp.Bandwidths = append(resp.Bandwidths, bw.String())
}
if bw := config.Ardop.ARQBandwidth; !bw.IsZero() {
resp.Default = bw.String()
}
case mode == MethodVaraHF:
case MethodVaraHF:
resp.Bandwidths = vara.Bandwidths()
if bw := config.VaraHF.Bandwidth; bw != 0 {
resp.Default = fmt.Sprintf("%d", bw)
Expand Down
2 changes: 1 addition & 1 deletion prompt_hub.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func (p *PromptHub) loop() {
p.c = make(chan *Prompt)
p.rc = make(chan PromptResponse)
for prompt := range p.c {
timeout := time.After(prompt.Deadline.Sub(time.Now()))
timeout := time.After(time.Until(prompt.Deadline))
select {
case <-timeout:
prompt.resp <- PromptResponse{ID: prompt.ID, Err: fmt.Errorf("deadline reached")}
Expand Down
7 changes: 4 additions & 3 deletions rmslist.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func ReadRMSList(ctx context.Context, forceDownload bool, filterFn func(rms RMS)
return nil, err
}

var slice = []RMS{}
slice := []RMS{}
for _, gw := range status.Gateways {
for _, channel := range gw.Channels {
r := RMS{
Expand Down Expand Up @@ -181,11 +181,12 @@ func toURL(gc cmsapi.GatewayChannel, targetCall string) *url.URL {
func addBandwidth(gc cmsapi.GatewayChannel, chURL *url.URL) {
bw := ""
modeF := strings.Fields(gc.SupportedModes)
if modeF[0] == "ARDOP" {
switch modeF[0] {
case "ARDOP":
if len(modeF) > 1 {
bw = modeF[1] + "MAX"
}
} else if modeF[0] == "VARA" {
case "VARA":
if len(modeF) > 1 && modeF[1] == "FM" {
// VARA FM should not set bandwidth in connect URL or sent over the command port,
// it's set in the VARA Setup dialog
Expand Down

0 comments on commit cf8d587

Please sign in to comment.