Просмотр исходного кода

Merge branch 'master' into tactics

Rod Hynes 8 лет назад
Родитель
Сommit
07d155cb6f

+ 1 - 1
.travis.yml

@@ -1,7 +1,7 @@
 language: go
 sudo: required
 go:
-- 1.9.4
+- 1.9.5
 addons:
   apt_packages:
     - libx11-dev

+ 1 - 1
ConsoleClient/Dockerfile

@@ -22,7 +22,7 @@ RUN apt-get update -y && apt-get install -y --no-install-recommends \
   && rm -rf /var/lib/apt/lists/*
 
 # Install Go.
-ENV GOVERSION=go1.9.4 GOROOT=/usr/local/go GOPATH=/go PATH=$PATH:/usr/local/go/bin:/go/bin CGO_ENABLED=1
+ENV GOVERSION=go1.9.5 GOROOT=/usr/local/go GOPATH=/go PATH=$PATH:/usr/local/go/bin:/go/bin CGO_ENABLED=1
 
 RUN curl -L https://storage.googleapis.com/golang/$GOVERSION.linux-amd64.tar.gz -o /tmp/go.tar.gz \
    && tar -C /usr/local -xzf /tmp/go.tar.gz \

+ 1 - 1
MobileLibrary/Android/Dockerfile

@@ -19,7 +19,7 @@ RUN apt-get update -y && apt-get install -y --no-install-recommends \
   && rm -rf /var/lib/apt/lists/*
 
 # Install Go.
-ENV GOVERSION=go1.9.4 GOROOT=/usr/local/go GOPATH=/go PATH=$PATH:/usr/local/go/bin:/go/bin CGO_ENABLED=1
+ENV GOVERSION=go1.9.5 GOROOT=/usr/local/go GOPATH=/go PATH=$PATH:/usr/local/go/bin:/go/bin CGO_ENABLED=1
 
 RUN curl -L https://storage.googleapis.com/golang/$GOVERSION.linux-amd64.tar.gz -o /tmp/go.tar.gz \
   && tar -C /usr/local -xzf /tmp/go.tar.gz \

+ 1 - 1
MobileLibrary/iOS/build-psiphon-framework.sh

@@ -15,7 +15,7 @@ fi
 set -x -u -e
 
 # Modify this value as we use newer Go versions.
-GO_VERSION_REQUIRED="1.9.4"
+GO_VERSION_REQUIRED="1.9.5"
 
 # Reset the PATH to macOS default. This is mainly so we don't execute the wrong
 # gomobile executable.

+ 7 - 0
MobileLibrary/psi/psi.go

@@ -85,6 +85,13 @@ func Start(
 		return fmt.Errorf("already started")
 	}
 
+	// Clients may toggle Stop/Start immediately to apply new config settings
+	// such as EgressRegion or Authorizations. When this restart is within the
+	// same process and in a memory contrained environment, it is useful to
+	// force garbage collection here to reclaim memory used by the previous
+	// Controller.
+	psiphon.DoGarbageCollection()
+
 	// Wrap the provider in a layer that locks a mutex before calling a provider function.
 	// The the provider callbacks are Java/Obj-C via gomobile, they are cgo calls that
 	// can cause OS threads to be spawned. The mutex prevents many calling goroutines from

+ 1 - 1
Server/Dockerfile-binary-builder

@@ -1,6 +1,6 @@
 FROM alpine:3.4
 
-ENV GOLANG_VERSION 1.9.4
+ENV GOLANG_VERSION 1.9.5
 ENV GOLANG_SRC_URL https://golang.org/dl/go$GOLANG_VERSION.src.tar.gz
 
 RUN set -ex \

+ 4 - 5
psiphon/controller.go

@@ -698,7 +698,7 @@ loop:
 				// Clear the reference to this discarded tunnel and immediately run
 				// a garbage collection to reclaim its memory.
 				connectedTunnel = nil
-				aggressiveGarbageCollection()
+				defaultGarbageCollection()
 
 				// Skip the rest of this case
 				break
@@ -1695,7 +1695,7 @@ loop:
 
 		// ConnectTunnel will allocate significant memory, so first attempt to
 		// reclaim as much as possible.
-		aggressiveGarbageCollection()
+		defaultGarbageCollection()
 
 		// Select the tunnel protocol. The selection will be made at random from
 		// protocols supported by the server entry, optionally limited by
@@ -1802,8 +1802,7 @@ loop:
 		if err != nil {
 			tunnel = nil
 		}
-
-		aggressiveGarbageCollection()
+		defaultGarbageCollection()
 
 		if err != nil {
 
@@ -1835,7 +1834,7 @@ loop:
 			// Clear the reference to this discarded tunnel and immediately run
 			// a garbage collection to reclaim its memory.
 			tunnel = nil
-			aggressiveGarbageCollection()
+			defaultGarbageCollection()
 		}
 
 		// Unblock other candidates only after delivering when

+ 4 - 0
psiphon/utils.go

@@ -227,3 +227,7 @@ func standardGarbageCollection() {
 func defaultGarbageCollection() {
 	debug.FreeOSMemory()
 }
+
+func DoGarbageCollection() {
+	defaultGarbageCollection()
+}