From d641dec7a4a8f9f07a0948966a6ba1383503ac2b Mon Sep 17 00:00:00 2001 From: Jono Wenger <jono@elixxir.io> Date: Wed, 6 Jul 2022 12:41:45 -0700 Subject: [PATCH] Remove duplicate e2e client creation in connection server --- connectServer/main.go | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/connectServer/main.go b/connectServer/main.go index 0d8cc28..2c783f6 100644 --- a/connectServer/main.go +++ b/connectServer/main.go @@ -86,15 +86,6 @@ func main() { } } - // Create an E2E client - // The connect packages handles AuthCallbacks, xxdk.DefaultAuthCallbacks is fine here - params := xxdk.GetDefaultE2EParams() - jww.INFO.Printf("Using E2E parameters: %+v", params) - e2eClient, err := xxdk.Login(baseClient, xxdk.DefaultAuthCallbacks{}, identity, params) - if err != nil { - jww.FATAL.Panicf("Unable to Login: %+v", err) - } - // Save contact file---------------------------------------------------------------- // Save the contact file so that client can connect to this server @@ -116,9 +107,10 @@ func main() { // Start connection server---------------------------------------------------------- // Start the connection server, which will allow clients to start connections with you + e2eParams := xxdk.GetDefaultE2EParams() connectionListParams := connect.DefaultConnectionListParams() - _, err = connect.StartServer( - identity, cb, baseClient, params, connectionListParams) + connectServer, err := connect.StartServer( + identity, cb, baseClient, e2eParams, connectionListParams) if err != nil { jww.FATAL.Panicf("Unable to start connection server: %+v", err) } @@ -127,7 +119,7 @@ func main() { // Set networkFollowerTimeout to a value of your choice (seconds) networkFollowerTimeout := 5 * time.Second - err = e2eClient.StartNetworkFollower(networkFollowerTimeout) + err = connectServer.E2e.StartNetworkFollower(networkFollowerTimeout) if err != nil { jww.FATAL.Panicf("Failed to start network follower: %+v", err) } @@ -152,7 +144,7 @@ func main() { // Create a tracker channel to be notified of network changes connected := make(chan bool, 10) // Provide a callback that will be signalled when network health status changes - e2eClient.GetCmix().AddHealthCallback( + connectServer.E2e.GetCmix().AddHealthCallback( func(isConnected bool) { connected <- isConnected }) -- GitLab