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

Potential panic fix related to 64 bit alignment in a struct required by golang atomic package, see https://golang.org/src/sync/atomic/doc.go#L50

Eugene Fryntov 9 лет назад
Родитель
Сommit
68c0665a4e
4 измененных файлов с 10 добавлено и 10 удалено
  1. 3 3
      psiphon/server/dns.go
  2. 1 1
      psiphon/server/meek.go
  3. 4 4
      psiphon/server/net.go
  4. 2 2
      psiphon/server/udp.go

+ 3 - 3
psiphon/server/dns.go

@@ -41,10 +41,10 @@ const (
 // "/etc/resolv.conf" on platforms where it is available; and
 // otherwise using a default value.
 type DNSResolver struct {
-	common.ReloadableFile
 	lastReloadTime int64
-	isReloading    int32
-	resolver       net.IP
+	common.ReloadableFile
+	isReloading int32
+	resolver    net.IP
 }
 
 // NewDNSResolver initializes a new DNSResolver, loading it with

+ 1 - 1
psiphon/server/meek.go

@@ -443,10 +443,10 @@ func (server *MeekServer) terminateConnection(
 }
 
 type meekSession struct {
+	lastActivity        int64
 	clientConn          *meekConn
 	meekProtocolVersion int
 	sessionIDSent       bool
-	lastActivity        int64
 }
 
 func (session *meekSession) touch() {

+ 4 - 4
psiphon/server/net.go

@@ -160,12 +160,12 @@ func (entry *LRUConnsEntry) Touch() {
 // either a successful read or write.
 //
 type ActivityMonitoredConn struct {
-	net.Conn
-	inactivityTimeout    time.Duration
-	activeOnWrite        bool
 	startTime            int64
 	lastReadActivityTime int64
-	lruEntry             *LRUConnsEntry
+	net.Conn
+	inactivityTimeout time.Duration
+	activeOnWrite     bool
+	lruEntry          *LRUConnsEntry
 }
 
 func NewActivityMonitoredConn(

+ 2 - 2
psiphon/server/udp.go

@@ -268,14 +268,14 @@ func (mux *udpPortForwardMultiplexer) removePortForward(connID uint16) {
 }
 
 type udpPortForward struct {
+	bytesUp      int64
+	bytesDown    int64
 	connID       uint16
 	preambleSize int
 	remoteIP     []byte
 	remotePort   uint16
 	conn         net.Conn
 	lruEntry     *LRUConnsEntry
-	bytesUp      int64
-	bytesDown    int64
 	mux          *udpPortForwardMultiplexer
 }