Skip to content

socket reader support split message by line #692

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 7, 2018

Conversation

mockerzzz
Copy link
Contributor

No description provided.

Default: "false",
Advance: true,
Description: "是否按'\\n'分隔内容(socket_split_by_line)",
ToolTip: "开启后,对socket内容按'\\n'进行分隔",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是否按行分隔内容(socket_split_by_line)

开启后,对socket内容按行进行分隔


if psr.IsSplitByLine{
vals := strings.Split(val, "\n")
for _, value := range vals {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trime一下,空行就continue

}
}else{
psr.readChan <- socketInfo{address: address, data: val}
}
}
}
Copy link
Contributor

@wonderflow wonderflow Aug 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

你这个逻辑块漏写了个地方,tcp的也是 streamSocketReader

if ssr.IsSplitByLine {
vals := strings.Split(val, "\n")
for _, value := range vals {
if value = strings.Trim(value, " "); value != "" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TrimSpace

@mockerzzz mockerzzz force-pushed the pdr-6648 branch 3 times, most recently from 6fbc640 to ac9e87f Compare August 7, 2018 03:48
@wonderflow
Copy link
Contributor

LGTM

@wonderflow wonderflow merged commit 1aaafdb into qiniu:master Aug 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants