Пример #1
0
func replyHandle(out proto.PkgResponse) []byte {
	var pkg = make([]byte, out.Length())
	_, err := out.Encode(pkg)
	if err != nil {
		log.Fatalf("Encode failed: %s\n", err)
	}
	return pkg
}
Пример #2
0
func errorHandle(out proto.PkgResponse, errCode int8) []byte {
	out.SetErrCode(errCode)
	var pkg = make([]byte, out.Length())
	_, err := out.Encode(pkg)
	if err != nil {
		log.Fatalf("Encode failed: %s\n", err)
	}
	return pkg
}