Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
cyfdecyf committed Mar 14, 2013
2 parents f4ae840 + 376e59b commit 2418f53
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion cmd/shadowsocks-local/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func initServers(config *ss.Config) {
i := 0
for s, passwd := range config.ServerPassword {
if !ss.HasPort(s) {
log.Fatal("no port for server %s, please specify port in the form of %s:port", s, s)
log.Fatalf("no port for server %s, please specify port in the form of %s:port\n", s, s)
}
cipher, ok := cipherCache[passwd]
if !ok {
Expand Down
12 changes: 5 additions & 7 deletions cmd/shadowsocks-server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ import (

var debug ss.DebugLog

var errAddrType = errors.New("addr type not supported")

const dnsGoroutineNum = 64

func getRequest(conn *ss.Conn) (host string, extra []byte, err error) {
Expand Down Expand Up @@ -54,7 +52,7 @@ func getRequest(conn *ss.Conn) (host string, extra []byte, err error) {
if buf[idType] == typeDm {
reqLen = int(buf[idDmLen]) + lenDmBase
} else if buf[idType] != typeIPv4 {
err = errAddrType
err = errors.New(fmt.Sprintf("addr type %d not supported", buf[idType]))
return
}

Expand Down Expand Up @@ -115,7 +113,7 @@ func handleConnection(conn *ss.Conn) {

host, extra, err := getRequest(conn)
if err != nil {
log.Println("error getting request:", err)
log.Println("error getting request", conn.RemoteAddr(), conn.LocalAddr(), err)
return
}
debug.Println("connecting", host)
Expand All @@ -126,7 +124,7 @@ func handleConnection(conn *ss.Conn) {
// EMFILE is process reaches open file limits, ENFILE is system limit
log.Println("dial error:", err)
} else {
debug.Println("error connecting to:", host, err)
log.Println("error connecting to:", host, err)
}
return
}
Expand Down Expand Up @@ -252,7 +250,7 @@ func waitSignal() {
func run(port, password string) {
ln, err := net.Listen("tcp", ":"+port)
if err != nil {
log.Printf("try listening port %v: %v\n", port, err)
log.Printf("error listening port %v: %v\n", port, err)
return
}
passwdManager.add(port, password, ln)
Expand All @@ -267,7 +265,7 @@ func run(port, password string) {
}
// Creating cipher upon first connection.
if cipher == nil {
debug.Println("creating cipher for port:", port)
log.Println("creating cipher for port:", port)
cipher, err = ss.NewCipher(password)
if err != nil {
log.Printf("Error generating cipher for port: %s password: %s\n", port, password)
Expand Down
4 changes: 2 additions & 2 deletions shadowsocks/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ func TestDeprecatedClientMultiServerArray(t *testing.T) {
t.Error("server option is not set correctly")
}
if srvArr[0] != "127.0.0.1" {
t.Error("1st server wrong, got %v", srvArr[0])
t.Errorf("1st server wrong, got %v", srvArr[0])
}
if srvArr[1] != "127.0.1.1" {
t.Error("2nd server wrong, got %v", srvArr[0])
t.Errorf("2nd server wrong, got %v", srvArr[0])
}
}

Expand Down

0 comments on commit 2418f53

Please sign in to comment.