Skip to content

Commit

Permalink
Check method on server startup.
Browse files Browse the repository at this point in the history
  • Loading branch information
cyfdecyf committed May 26, 2013
1 parent 0a9a2cd commit 5bc6437
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
9 changes: 7 additions & 2 deletions cmd/shadowsocks-server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,9 @@ func run(port, password string) {
log.Println("creating cipher for port:", port)
cipher, err = ss.NewCipher(config.Method, password)
if err != nil {
log.Printf("Error generating cipher for port: %s password: %s\n", port, password)
return
log.Printf("Error generating cipher for port: %s %v\n", port, err)
conn.Close()
continue
}
}
go handleConnection(ss.NewConn(conn, cipher.Copy()))
Expand Down Expand Up @@ -345,6 +346,10 @@ func main() {
} else {
ss.UpdateConfig(config, &cmdConfig)
}
if err = ss.CheckCipherMethod(config.Method); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
if err = unifyPortPassword(config); err != nil {
os.Exit(1)
}
Expand Down
1 change: 1 addition & 0 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"server_port":8388,
"local_port":1080,
"password":"barfoo!",
"method": null,
"timeout":600
}

0 comments on commit 5bc6437

Please sign in to comment.