diff --git a/socketserver/server/backend.go b/socketserver/server/backend.go index 0294325c..ae085093 100644 --- a/socketserver/server/backend.go +++ b/socketserver/server/backend.go @@ -12,7 +12,6 @@ import ( "net/url" "strconv" "strings" - "sync" "time" "github.com/pmylund/go-cache" @@ -24,6 +23,20 @@ const bPathAddTopic = "/topics" const bPathAggStats = "/stats" const bPathOtherCommand = "/cmd/" +type backend struct { + HTTPClient http.Client + baseURL string + responseCache *cache.Cache + + postStatsURL string + addTopicURL string + announceStartupURL string + + sharedKey [32]byte + serverID int + + lastSuccess map[string]time.Time +} var backendHTTPClient http.Client var backendURL string var responseCache *cache.Cache @@ -35,8 +48,6 @@ var announceStartupURL string var backendSharedKey [32]byte var serverID int -var messageBufferPool sync.Pool - var lastBackendSuccess map[string]time.Time func setupBackend(config *ConfigFile) { @@ -61,8 +72,6 @@ func setupBackend(config *ConfigFile) { } Statistics.Health.Backend = lastBackendSuccess - messageBufferPool.New = New4KByteBuffer - var theirPublic, ourPrivate [32]byte copy(theirPublic[:], config.BackendPublicKey) copy(ourPrivate[:], config.OurPrivateKey)