Make fields in ResponseInfo be flat

This commit is contained in:
Jae Kwon
2016-12-26 17:44:36 -08:00
committed by Ethan Buchman
parent 0d82d26408
commit 8b76f3dd00
15 changed files with 186 additions and 254 deletions

View File

@ -292,14 +292,17 @@ func (cli *socketClient) FlushSync() error {
return cli.Error()
}
func (cli *socketClient) InfoSync() (types.Result, *types.TMSPInfo, *types.LastBlockInfo, *types.ConfigInfo) {
func (cli *socketClient) InfoSync() (resInfo types.ResponseInfo, err error) {
reqres := cli.queueRequest(types.ToRequestInfo())
cli.FlushSync()
if err := cli.Error(); err != nil {
return types.ErrInternalError.SetLog(err.Error()), nil, nil, nil
return resInfo, err
}
if resInfo_ := reqres.Response.GetInfo(); resInfo_ != nil {
return *resInfo_, nil
} else {
return resInfo, nil
}
resp := reqres.Response.GetInfo()
return types.Result{Code: OK, Data: []byte(resp.Info), Log: LOG}, resp.TmspInfo, resp.LastBlock, resp.Config
}
func (cli *socketClient) SetOptionSync(key string, value string) (res types.Result) {