File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -217,8 +217,9 @@ func (s *Server) Kill() error {
217
217
}
218
218
}
219
219
// Only need to close channel once to broadcast to all waiting
220
- close (s .doneTcp )
221
-
220
+ if s .doneTcp != nil {
221
+ close (s .doneTcp )
222
+ }
222
223
return nil
223
224
}
224
225
Original file line number Diff line number Diff line change @@ -121,6 +121,20 @@ func (s *ServerSuite) TestConnectionClose(c *C) {
121
121
}
122
122
}
123
123
124
+ func (s * ServerSuite ) TestConnectionUDPKill (c * C ) {
125
+ for _ , closeConnection := range []bool {true , false } {
126
+ handler := new (HandlerMock )
127
+ server := NewServer ()
128
+ server .SetFormat (RFC5424 )
129
+ server .SetHandler (handler )
130
+ con := ConnMock {ReadData : []byte (exampleSyslog )}
131
+ server .goScanConnection (& con , closeConnection )
132
+ server .Kill ()
133
+ server .Wait ()
134
+ c .Check (con .isClosed , Equals , closeConnection )
135
+ }
136
+ }
137
+
124
138
func (s * ServerSuite ) TestTcpTimeout (c * C ) {
125
139
handler := new (HandlerMock )
126
140
server := NewServer ()
You can’t perform that action at this time.
0 commit comments