Compare commits
No commits in common. "main" and "v0.6.1" have entirely different histories.
1 changed files with 6 additions and 7 deletions
|
@ -104,7 +104,7 @@ func (s *Signald) Close() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Listen listens for events from signald
|
// Listen listens for events from signald
|
||||||
func (s *Signald) Listen(c chan client_protocol.BasicResponse) error {
|
func (s *Signald) Listen(c chan client_protocol.BasicResponse) {
|
||||||
for {
|
for {
|
||||||
msg, err := s.readNext()
|
msg, err := s.readNext()
|
||||||
if err == io.EOF {
|
if err == io.EOF {
|
||||||
|
@ -112,11 +112,7 @@ func (s *Signald) Listen(c chan client_protocol.BasicResponse) error {
|
||||||
if c != nil {
|
if c != nil {
|
||||||
close(c)
|
close(c)
|
||||||
}
|
}
|
||||||
return nil
|
return
|
||||||
}
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if msg.Type == "unexpected_error" {
|
if msg.Type == "unexpected_error" {
|
||||||
|
@ -178,6 +174,9 @@ func (s *Signald) readNext() (b client_protocol.BasicResponse, err error) {
|
||||||
} else {
|
} else {
|
||||||
err = json.NewDecoder(s.socket).Decode(&b)
|
err = json.NewDecoder(s.socket).Decode(&b)
|
||||||
}
|
}
|
||||||
|
if err != nil {
|
||||||
|
log.Println("signald-go: error decoding message from signald:", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue