Fix another "deadlock" in METADAPT-A

What fucking idiot go developer decided recv from a nil channel
locks the entire program. ?????? just have it return zero value and
false.
This commit is contained in:
Sasha Koshka 2025-01-28 16:14:27 -05:00
parent 4daccca66a
commit 5b42030f9d

View File

@ -181,15 +181,18 @@ func (this *transA) Send(method uint16, data []byte) error {
}
func (this *transA) Receive() (method uint16, data []byte, err error) {
message, ok := <- this.incoming.Receive()
if !ok {
if this.parent.err == nil {
return 0, nil, fmt.Errorf("could not receive message: %w", io.EOF)
} else {
return 0, nil, this.parent.err
receive := this.incoming.Receive()
if receive != nil {
if message, ok := <- receive; ok {
return message.method, message.payload, nil
}
}
return message.method, message.payload, nil
if this.parent.err == nil {
return 0, nil, fmt.Errorf("could not receive message: %w", io.EOF)
} else {
return 0, nil, this.parent.err
}
}
type incomingMessage struct {