Skip to content

Commit

Permalink
remove BlockUntilReady because it was unused
Browse files Browse the repository at this point in the history
  • Loading branch information
umbynos committed Aug 16, 2021
1 parent a86a61a commit a21ae9e
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 40 deletions.
5 changes: 2 additions & 3 deletions bufferflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package main

type Bufferflow interface {
Init()
BlockUntilReady(cmd string, id string) (bool, bool) // implement this method
OnIncomingData(data string) // implement this method
Close() // implement this method
OnIncomingData(data string) // implement this method
Close() // implement this method
}
5 changes: 0 additions & 5 deletions bufferflow_default.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ Loop:
close(b.input) // close the input channel at the end of the computation
}

func (b *BufferflowDefault) BlockUntilReady(cmd string, id string) (bool, bool) {
//log.Printf("BlockUntilReady() start\n")
return true, false
}

func (b *BufferflowDefault) OnIncomingData(data string) {
b.input <- data
}
Expand Down
5 changes: 0 additions & 5 deletions bufferflow_timed.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,6 @@ Loop:
close(b.input)
}

func (b *BufferflowTimed) BlockUntilReady(cmd string, id string) (bool, bool) {
//log.Printf("BlockUntilReady() start\n")
return true, false
}

func (b *BufferflowTimed) OnIncomingData(data string) {
b.input <- data
}
Expand Down
5 changes: 0 additions & 5 deletions bufferflow_timedraw.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,6 @@ Loop:
close(b.input)
}

func (b *BufferflowTimedRaw) BlockUntilReady(cmd string, id string) (bool, bool) {
//log.Printf("BlockUntilReady() start\n")
return true, false
}

func (b *BufferflowTimedRaw) OnIncomingData(data string) {
b.input <- data
}
Expand Down
28 changes: 6 additions & 22 deletions serialport.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,18 +174,10 @@ func (p *serport) writerBuffered() {
// sees something come in
for data := range p.sendBuffered {

// we want to block here if we are being asked to pause.
goodToGo, _ := p.bufferwatcher.BlockUntilReady(string(data), "")

if goodToGo == false {
log.Println("We got back from BlockUntilReady() but apparently we must cancel this cmd")
// since we won't get a buffer decrement in p.sendNoBuf, we must do it here
p.itemsInBuffer--
} else {
// send to the non-buffered serial port writer
//log.Println("About to send to p.sendNoBuf channel")
p.sendNoBuf <- []byte(data)
}
// send to the non-buffered serial port writer
//log.Println("About to send to p.sendNoBuf channel")
p.sendNoBuf <- []byte(data)

}
msgstr := "writerBuffered just got closed. make sure you make a new one. port:" + p.portConf.Name
log.Println(msgstr)
Expand Down Expand Up @@ -249,17 +241,9 @@ func (p *serport) writerRaw() {
}
log.Println(string(sDec))

// we want to block here if we are being asked to pause.
goodToGo, _ := p.bufferwatcher.BlockUntilReady(string(data), "")
// send to the non-buffered serial port writer
p.sendNoBuf <- sDec

if goodToGo == false {
log.Println("We got back from BlockUntilReady() but apparently we must cancel this cmd")
// since we won't get a buffer decrement in p.sendNoBuf, we must do it here
p.itemsInBuffer--
} else {
// send to the non-buffered serial port writer
p.sendNoBuf <- sDec
}
}
msgstr := "writerRaw just got closed. make sure you make a new one. port:" + p.portConf.Name
log.Println(msgstr)
Expand Down

0 comments on commit a21ae9e

Please sign in to comment.