From 655b6b211ae6df0186abd740f248939f7ddeaec1 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Mon, 31 Mar 2025 16:59:18 +0800 Subject: Add descriptive comments to most Go functions --- git_hooks_handle_other.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'git_hooks_handle_other.go') diff --git a/git_hooks_handle_other.go b/git_hooks_handle_other.go index f1b2e04..4285784 100644 --- a/git_hooks_handle_other.go +++ b/git_hooks_handle_other.go @@ -315,6 +315,10 @@ func hooksHandler(conn net.Conn) { _, _ = conn.Write([]byte{hookRet}) } +// serveGitHooks handles connections on the specified network listener and +// treats incoming connections as those from git hook handlers by spawning +// sessions. The listener must be a SOCK_STREAM UNIX domain socket. The +// function itself blocks. func serveGitHooks(listener net.Listener) error { for { conn, err := listener.Accept() @@ -325,6 +329,9 @@ func serveGitHooks(listener net.Listener) error { } } +// allZero returns true if all runes in a given string are '0'. The comparison +// is not constant time and must not be used in contexts where time-based side +// channel attacks are a concern. func allZero(s string) bool { for _, r := range s { if r != '0' { -- cgit v1.2.3