Compare commits

..

2 commits

Author SHA1 Message Date
d983bfb9a3 improve error handling for listen 2022-12-29 17:45:22 -08:00
097e95bdb1 Add version 17 migration
Fixes #15
2022-12-18 22:00:58 -08:00
2 changed files with 8 additions and 6 deletions

View file

@ -33,6 +33,7 @@ var (
{InstalledRank: 4, Version: "14", Description: "multiple identity keys per account", Script: "V14__multiple_identity_keys_per_account.sql", Checksum: -1635788950},
{InstalledRank: 5, Version: "15", Description: "profiles tables", Script: "V15__profiles_tables.sql", Checksum: 809686180},
{InstalledRank: 6, Version: "16", Description: "destination uuid in envelope", Script: "V16__destination_uuid_in_envelope.sql", Checksum: 357656854},
{InstalledRank: 7, Version: "17", Description: "update server ca", Script: "V17__update_server_ca.sql", Checksum: 1647934070},
}
sqlitePath string

View file

@ -104,7 +104,7 @@ func (s *Signald) Close() error {
}
// Listen listens for events from signald
func (s *Signald) Listen(c chan client_protocol.BasicResponse) {
func (s *Signald) Listen(c chan client_protocol.BasicResponse) error {
for {
msg, err := s.readNext()
if err == io.EOF {
@ -112,7 +112,11 @@ func (s *Signald) Listen(c chan client_protocol.BasicResponse) {
if c != nil {
close(c)
}
return
return nil
}
if err != nil {
return err
}
if msg.Type == "unexpected_error" {
@ -174,9 +178,6 @@ func (s *Signald) readNext() (b client_protocol.BasicResponse, err error) {
} else {
err = json.NewDecoder(s.socket).Decode(&b)
}
if err != nil {
log.Println("signald-go: error decoding message from signald:", err)
return
}
return
}