Repository navigation
add socket reader json format - #728
Merged
Merged
Conversation
wonderflow
reviewed
Aug 27, 2018
| const ( | ||
| SocketRulePacket = "按包获取" | ||
| SocketRuleJson = "按json获取" | ||
| SocketRuleLine = "按行获取" |
Contributor
There was a problem hiding this comment.
按原始包读取
按json格式读取
按换行符读取
wonderflow
reviewed
Aug 27, 2018
| Default: "false", | ||
| Advance: true, | ||
| Description: "获取方式(socket_rule)", | ||
| ToolTip: "默认对socket内容按包获取", |
Contributor
There was a problem hiding this comment.
json仅对tcp有效,json的选项放在最后面
wonderflow
reviewed
Aug 27, 2018
| return err | ||
| } | ||
|
|
||
| func tryDecodeReader(decoder *json.Decoder) bool { |
Contributor
There was a problem hiding this comment.
这个函数名字不是很清晰,改为 isDecodeReaderExpired 是不是更好?
wonderflow
reviewed
Aug 27, 2018
|
|
||
| if err != nil { | ||
| log.Errorf("decode buffered read error: %v", err) | ||
| return true |
Contributor
There was a problem hiding this comment.
出了error还是true吗,单测里可以测到这种case是什么情况吗
wonderflow
reviewed
Aug 27, 2018
| if !tryDecodeReader(decoder) { | ||
| decoder = json.NewDecoder(bufioReader) | ||
| } | ||
| log.Debugf("net error %v", netErr) |
Contributor
There was a problem hiding this comment.
这个debug日志要么改成warn吧,写的规范一些,其他日志也是,标明 runner是什么,reader是什么
redHJ
force-pushed
the
pdr-6670
branch
2 times, most recently
from
August 27, 2018 08:12
b4b0e4b to
ab26641
Compare
wonderflow
reviewed
Aug 27, 2018
| if ssr.netproto == "tcp" || ssr.netproto == "tcp4" || ssr.netproto == "tcp6" { | ||
| if err := ssr.setKeepAlive(c); err != nil { | ||
| log.Error(fmt.Errorf("unable to configure keep alive (%s): %s", ssr.ServiceAddress, err)) | ||
| log.Error(fmt.Errorf("runner[%v] Reader %q unable to configure keep alive (%s): %s", ssr.meta.RunnerName, ssr.Name(), ssr.ServiceAddress, err)) |
wonderflow
reviewed
Aug 27, 2018
| if !tryDecodeReader(decoder) { | ||
| decoder = json.NewDecoder(bufioReader) | ||
| } | ||
| log.Warnf("runner[%v] Reader %q net error %v", ssr.meta.RunnerName, ssr.Name(), netErr) |
wonderflow
reviewed
Aug 27, 2018
| if err != nil { | ||
| log.Errorf("runner[%v] Reader %q read decoder buffered error: %v") | ||
| } else { | ||
| log.Errorf("runner[%v] Reader %q read streaming message: %v", ssr.meta.RunnerName, ssr.Name(), string(readBytes)) |
redHJ
force-pushed
the
pdr-6670
branch
2 times, most recently
from
August 27, 2018 13:23
620acc6 to
c5f5cac
Compare
Contributor
|
LGTM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@wonderflow
@unknwon