]> Cypherpunks.ru repositories - gostls13.git/commit
syscall: hoist Getsockname out of NetlinkRIB loops
authorMatt Layher <mdlayher@gmail.com>
Wed, 21 Jul 2021 20:03:34 +0000 (16:03 -0400)
committerMatt Layher <mdlayher@gmail.com>
Mon, 16 Aug 2021 17:40:17 +0000 (17:40 +0000)
commit5c7a460a1c108e5bf7a99817b86ebded7ce81812
tree8228d6e6d4459dba7ff762f935451a3262aca315
parent850768bbc9fd2d74a88233fa1f46791d08d1afc8
syscall: hoist Getsockname out of NetlinkRIB loops

Calling Getsockname once to fetch the Pid field from the *SockaddrNetlink
is necessary, but this data will remain static for the rest of the netlink
socket's lifetime. Moving this call and type assertion outside of the inner
loops will remove a number of unnecessary system calls.

Change-Id: I7e7e81866af1a31fccdaaf7531efd6cc4cbb8926
Reviewed-on: https://go-review.googlesource.com/c/go/+/336369
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Matt Layher <mdlayher@gmail.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
src/syscall/netlink_linux.go