Fixing up some error handling

This commit is contained in:
Sarah Jamie Lewis 2016-01-05 20:42:49 -08:00
parent 04f99b298f
commit 91036c918d
1 changed files with 7 additions and 1 deletions

View File

@ -201,7 +201,12 @@ func (r *Ricochet) Connect(from string, to string) error {
data, err = proto.Marshal(ahsPacket) data, err = proto.Marshal(ahsPacket)
r.sendPacket(data, 1) r.sendPacket(data, 1)
response, _ = r.getMessages() response, err = r.getMessages()
if err != nil {
return err
}
resultResponse, _ := r.decodePacket(response[0], AUTH) resultResponse, _ := r.decodePacket(response[0], AUTH)
r.logger.Print("Received Result: ", resultResponse) r.logger.Print("Received Result: ", resultResponse)
@ -288,6 +293,7 @@ func (r *Ricochet) negotiateVersion() error {
version[1] = 0x4D version[1] = 0x4D
version[2] = 0x01 version[2] = 0x01
version[3] = 0x01 version[3] = 0x01
fmt.Fprintf(r.conn, "%s", version) fmt.Fprintf(r.conn, "%s", version)
r.logger.Print("Negotiating Version ", version) r.logger.Print("Negotiating Version ", version)
res, err := r.recv() res, err := r.recv()