func (b *Broker) WriteOK(c net.Conn) error { var result task.StatusResult result.Status = 0 ret, err := json.Marshal(result) if err != nil { return err } _, err = c.Write(ret) if err != nil { return err } return nil }
func (b *Broker) WriteError(err error, c net.Conn) error { var result task.StatusResult if err == nil { return nil } result.Status = 1 result.Message = err.Error() ret, err := json.Marshal(result) if err != nil { return err } _, err = c.Write(ret) if err != nil { return err } return nil }