Skip to content

socket reader support split message by line - #692

Merged
wonderflow merged 1 commit into
qiniu:masterfrom
mockerzzz:pdr-6648
Aug 7, 2018
Merged

wonderflow merged 1 commit into
qiniu:masterfrom
mockerzzz:pdr-6648

Conversation

@mockerzzz

Copy link
Copy Markdown
Contributor

No description provided.

Comment thread reader/rest_reader_models.go Outdated
Default: "false",
Advance: true,
Description: "是否按'\\n'分隔内容(socket_split_by_line)",
ToolTip: "开启后,对socket内容按'\\n'进行分隔",

Copy link
Copy Markdown
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内容按行进行分隔

Comment thread reader/socket/socket.go

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

trime一下,空行就continue

Comment thread reader/socket/socket.go
psr.readChan <- socketInfo{address: address, data: val}
}
}
}

@wonderflow wonderflow Aug 7, 2018 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

Comment thread reader/socket/socket.go Outdated
if ssr.IsSplitByLine {
vals := strings.Split(val, "\n")
for _, value := range vals {
if value = strings.Trim(value, " "); value != "" {

Copy link
Copy Markdown
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
Copy Markdown
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