Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
C
Coredns
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Railgun
Coredns
Commits
3fb07161
Commit
3fb07161
authored
Feb 02, 2018
by
Uladzimir Trehubenka
Committed by
Miek Gieben
Feb 02, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed dnstap panic after graceful restart (send on closed channel) (#1479)
parent
b93a36b2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
plugin/dnstap/dnstapio/io.go
plugin/dnstap/dnstapio/io.go
+8
-7
No files found.
plugin/dnstap/dnstapio/io.go
View file @
3fb07161
...
@@ -24,6 +24,7 @@ type dnstapIO struct {
...
@@ -24,6 +24,7 @@ type dnstapIO struct {
enc
*
dnstapEncoder
enc
*
dnstapEncoder
queue
chan
tap
.
Dnstap
queue
chan
tap
.
Dnstap
dropped
uint32
dropped
uint32
quit
chan
struct
{}
}
}
// New returns a new and initialized DnstapIO.
// New returns a new and initialized DnstapIO.
...
@@ -36,6 +37,7 @@ func New(endpoint string, socket bool) DnstapIO {
...
@@ -36,6 +37,7 @@ func New(endpoint string, socket bool) DnstapIO {
Bidirectional
:
true
,
Bidirectional
:
true
,
}),
}),
queue
:
make
(
chan
tap
.
Dnstap
,
queueSize
),
queue
:
make
(
chan
tap
.
Dnstap
,
queueSize
),
quit
:
make
(
chan
struct
{}),
}
}
}
}
...
@@ -92,7 +94,7 @@ func (dio *dnstapIO) closeConnection() {
...
@@ -92,7 +94,7 @@ func (dio *dnstapIO) closeConnection() {
// Close waits until the I/O routine is finished to return.
// Close waits until the I/O routine is finished to return.
func
(
dio
*
dnstapIO
)
Close
()
{
func
(
dio
*
dnstapIO
)
Close
()
{
close
(
dio
.
qu
eue
)
close
(
dio
.
qu
it
)
}
}
func
(
dio
*
dnstapIO
)
flushBuffer
()
{
func
(
dio
*
dnstapIO
)
flushBuffer
()
{
...
@@ -124,12 +126,11 @@ func (dio *dnstapIO) serve() {
...
@@ -124,12 +126,11 @@ func (dio *dnstapIO) serve() {
timeout
:=
time
.
After
(
flushTimeout
)
timeout
:=
time
.
After
(
flushTimeout
)
for
{
for
{
select
{
select
{
case
payload
,
ok
:=
<-
dio
.
queue
:
case
<-
dio
.
quit
:
if
!
ok
{
dio
.
flushBuffer
()
dio
.
flushBuffer
()
dio
.
closeConnection
()
dio
.
closeConnection
()
return
return
case
payload
:=
<-
dio
.
queue
:
}
dio
.
write
(
&
payload
)
dio
.
write
(
&
payload
)
case
<-
timeout
:
case
<-
timeout
:
if
dropped
:=
atomic
.
SwapUint32
(
&
dio
.
dropped
,
0
);
dropped
>
0
{
if
dropped
:=
atomic
.
SwapUint32
(
&
dio
.
dropped
,
0
);
dropped
>
0
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment