Skip to content

Commit 429245c

Browse files
committed
Fix null datagram address
With unix datagrams, apparently the address can be null. Use an empty string as the address in this case. Fixes #26 Signed-off-by: Alex Bligh <[email protected]>
1 parent e079f55 commit 429245c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

server.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,11 @@ func (s *Server) goReceiveDatagrams(connection net.Conn) {
323323
for ; (n > 0) && (buf[n-1] < 32); n-- {
324324
}
325325
if n > 0 {
326-
s.datagramChannel <- DatagramMessage{buf[:n], addr.String()}
326+
var address string
327+
if addr != nil {
328+
address = addr.String()
329+
}
330+
s.datagramChannel <- DatagramMessage{buf[:n], address}
327331
}
328332
} else {
329333
// there has been an error. Either the server has been killed

0 commit comments

Comments
 (0)