[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [obfs-flash/master] Remember method name per chain.



commit 826e705c1302e750f8850d181a489e3c3fdb32dd
Author: David Fifield <david@xxxxxxxxxxxxxxx>
Date:   Wed Dec 4 02:18:19 2013 -0800

    Remember method name per chain.
---
 obfs-flash-server.go |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/obfs-flash-server.go b/obfs-flash-server.go
index 20b5b65..a62af47 100644
--- a/obfs-flash-server.go
+++ b/obfs-flash-server.go
@@ -18,7 +18,6 @@ import (
 
 import "git.torproject.org/pluggable-transports/websocket.git/src/pt"
 
-const ptMethodName = "obfs3_websocket"
 const connStackSize = 10
 const subprocessWaitTimeout = 30 * time.Second
 
@@ -83,6 +82,7 @@ func (procs ProcList) Kill() {
 }
 
 type Chain struct {
+	MethodName   string
 	ExtLn, IntLn *net.TCPListener
 	ProcsAddr    *net.TCPAddr
 	Procs        ProcList
@@ -286,7 +286,7 @@ func handleInternalConnection(conn *net.TCPConn, chain *Chain) error {
 	extConn := elem.(*net.TCPConn)
 	log("Connecting to ORPort using remote addr %s.", extConn.RemoteAddr())
 	log("handleInternalConnection: now %d conns buffered.", chain.Conns.Length())
-	or, err := pt.ConnectOr(&ptInfo, extConn, ptMethodName)
+	or, err := pt.ConnectOr(&ptInfo, extConn, chain.MethodName)
 	if err != nil {
 		log("Error connecting to ORPort: %s.", err)
 		return err
@@ -322,10 +322,11 @@ loop:
 	}
 }
 
-func startChain(bindAddr *net.TCPAddr, plugins []ServerTransportPlugin) (*Chain, error) {
+func startChain(methodName string, bindAddr *net.TCPAddr, plugins []ServerTransportPlugin) (*Chain, error) {
 	chain := &Chain{}
 	var err error
 
+	chain.MethodName = methodName
 	chain.Conns = NewStack(connStackSize)
 
 	// Start internal listener (the proxy chain connects back to this).
@@ -452,7 +453,7 @@ func main() {
 			continue
 		}
 
-		chain, err := startChain(bindAddr.Addr, plugins)
+		chain, err := startChain(bindAddr.MethodName, bindAddr.Addr, plugins)
 		if err != nil {
 			pt.SmethodError(bindAddr.MethodName, err.Error())
 			continue

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits