|
@@ -133,10 +133,12 @@ func (socket *Socket) Write(data string) error {
|
133
|
133
|
|
134
|
134
|
// timedFillLineToSendExists either sends the note or times out.
|
135
|
135
|
func (socket *Socket) timedFillLineToSendExists(duration time.Duration) {
|
|
136
|
+ lineToSendTimeout := time.NewTimer(duration)
|
|
137
|
+ defer lineToSendTimeout.Stop()
|
136
|
138
|
select {
|
137
|
139
|
case socket.lineToSendExists <- true:
|
138
|
140
|
// passed data successfully
|
139
|
|
- case <-time.After(duration):
|
|
141
|
+ case <-lineToSendTimeout.C:
|
140
|
142
|
// timed out send
|
141
|
143
|
}
|
142
|
144
|
}
|