Skip to content

Commit c1bdc2b

Browse files
committed
fix web-server port being overwritten 🤦🏻‍♂️
1 parent 4fc615a commit c1bdc2b

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

bufferflow_timed.go

+5-4
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@ type BufferflowTimed struct {
1818

1919
var (
2020
bufferedOutput string
21+
sPort string
2122
)
2223

2324
func (b *BufferflowTimed) Init() {
2425
log.Println("Initting timed buffer flow (output once every 16ms)")
2526
bufferedOutput = ""
26-
port = ""
27+
sPort = ""
2728

2829
go func() {
2930
b.ticker = time.NewTicker(16 * time.Millisecond)
@@ -33,16 +34,16 @@ func (b *BufferflowTimed) Init() {
3334
select {
3435
case data := <-b.Input:
3536
bufferedOutput = bufferedOutput + data
36-
port = b.Port
37+
sPort = b.Port
3738
case <-b.ticker.C:
3839
if bufferedOutput != "" {
39-
m := SpPortMessage{port, bufferedOutput}
40+
m := SpPortMessage{sPort, bufferedOutput}
4041
buf, _ := json.Marshal(m)
4142
// data is now encoded in base64 format
4243
// need a decoder on the other side
4344
b.Output <- []byte(buf)
4445
bufferedOutput = ""
45-
port = ""
46+
sPort = ""
4647
}
4748
case <-b.done:
4849
break Loop

0 commit comments

Comments
 (0)