From 498028a0cb35e073fb740bc03a8b0e29644528b6 Mon Sep 17 00:00:00 2001
From: jbhusson <jonah@elixxir.io>
Date: Mon, 22 Aug 2022 12:29:43 -0400
Subject: [PATCH] Comment fixes, formatting changes

---
 connect/connection.go | 8 ++++++++
 connect/grpcConn.go   | 3 +++
 connect/host.go       | 9 ++++++---
 connect/webConn.go    | 2 ++
 4 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/connect/connection.go b/connect/connection.go
index 6aa3655..4eccac6 100644
--- a/connect/connection.go
+++ b/connect/connection.go
@@ -12,11 +12,19 @@ const (
 // Connection is an interface designed to sit between hosts and connections
 // to allow use of grpcweb clients.
 type Connection interface {
+	// GetWebConn returns the grpcweb ClientConn for use in browsers.
+	// It panics if called on a grpc client.
 	GetWebConn() *grpcweb.ClientConn
+	// GetGrpcConn returns the grpc ClientConn for standard use.
+	// It panics if called on a grpcweb client.
 	GetGrpcConn() *grpc.ClientConn
+	// Connect initiates a connection with the host using connection logic
+	// supplied by the underlying class.
 	Connect() error
+	// IsWeb returns true if the connection uses grpcweb
 	IsWeb() bool
 
+	// Close closes the underlying connection
 	Close() error
 
 	clientConnHelpers
diff --git a/connect/grpcConn.go b/connect/grpcConn.go
index fadd45d..69a42bd 100644
--- a/connect/grpcConn.go
+++ b/connect/grpcConn.go
@@ -113,6 +113,7 @@ func (gc *grpcConn) connectGrpcHelper() (err error) {
 	return
 }
 
+// Close calls the internal Close function on the grpcConn
 func (gc *grpcConn) Close() error {
 	if gc.grpcConn == nil {
 		return nil
@@ -138,6 +139,8 @@ func (gc *grpcConn) disconnect() {
 	}
 }
 
+// isAlive returns true if the grpcConn is non-nil and alive
+// must already be under the connectionMux
 func (gc *grpcConn) isAlive() bool {
 	if gc.grpcConn == nil {
 		return false
diff --git a/connect/host.go b/connect/host.go
index c720640..2acc9ad 100644
--- a/connect/host.go
+++ b/connect/host.go
@@ -81,17 +81,20 @@ type Host struct {
 }
 
 // NewHost creates a new host object which will use GRPC.
-func NewHost(id *id.ID, address string, cert []byte, params HostParams) (host *Host, err error) {
+func NewHost(id *id.ID, address string, cert []byte,
+	params HostParams) (host *Host, err error) {
 	return newHost(id, address, cert, params, false)
 }
 
 // NewHostWeb creates a new host object which will use the grpcweb library.
-func NewHostWeb(id *id.ID, address string, cert []byte, params HostParams) (host *Host, err error) {
+func NewHostWeb(id *id.ID, address string, cert []byte,
+	params HostParams) (host *Host, err error) {
 	return newHost(id, address, cert, params, true)
 }
 
 // newHost is a helper which creates a new Host object
-func newHost(id *id.ID, address string, cert []byte, params HostParams, isWeb bool) (host *Host, err error) {
+func newHost(id *id.ID, address string, cert []byte, params HostParams,
+	isWeb bool) (host *Host, err error) {
 
 	windowSize := int32(0)
 
diff --git a/connect/webConn.go b/connect/webConn.go
index 2d7e7d1..f730291 100644
--- a/connect/webConn.go
+++ b/connect/webConn.go
@@ -130,6 +130,8 @@ func (wc *webConn) disconnect() {
 
 }
 
+// isAlive returns true if the webConn is non-nil and alive
+// must already be under the connectionMux
 func (wc *webConn) isAlive() bool {
 	// TODO this cannot be determined until grpcweb clients have a persistent connection
 	if wc.webConn == nil {
-- 
GitLab