diff --git a/CHANGELOG b/CHANGELOG index 5a8a8b04..2f844357 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,7 @@ -0.9.2 (2014-09-21) +0.9.4 (2014-10-08) + * Bug fix (#179): close stat file after load + +0.9.3 (2014-09-21) * Support new encryption method "rc4-md5" 0.9.2 (2014-07-23) diff --git a/README.md b/README.md index 2b93473a..1265ca8f 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ COW 是一个简化穿墙的 HTTP 代理服务器。它能自动检测被墙网 [English README](README-en.md). -当前版本:0.9.3 [CHANGELOG](CHANGELOG) +当前版本:0.9.4 [CHANGELOG](CHANGELOG) [![Build Status](https://travis-ci.org/cyfdecyf/cow.png?branch=master)](https://travis-ci.org/cyfdecyf/cow) **欢迎在 develop branch 进行开发并发送 pull request :)** diff --git a/config.go b/config.go index 3e7a11ba..8784fe01 100644 --- a/config.go +++ b/config.go @@ -15,7 +15,7 @@ import ( ) const ( - version = "0.9.3" + version = "0.9.4" defaultListenAddr = "127.0.0.1:7777" ) diff --git a/install-cow.sh b/install-cow.sh index 63254464..84a4ddeb 100755 --- a/install-cow.sh +++ b/install-cow.sh @@ -1,6 +1,6 @@ #!/bin/bash -version=0.9.3 +version=0.9.4 arch=`uname -m` case $arch in diff --git a/sitestat.go b/sitestat.go index 5c4d5cc0..e5c0ceb1 100644 --- a/sitestat.go +++ b/sitestat.go @@ -308,7 +308,7 @@ func (ss *SiteStat) store(statPath string) (err error) { os.Remove(statPath + ".bak") os.Rename(statPath, statPath+".bak") if err = os.Rename(f.Name(), statPath); err != nil { - errl.Println("can't rename newly created stat file", err) + errl.Println("rename new stat file", err) return } return @@ -381,12 +381,12 @@ func (ss *SiteStat) load(file string) (err error) { } } }() - var exists bool - if exists, err = isFileExists(file); err != nil { + var exist bool + if exist, err = isFileExists(file); err != nil { fmt.Println("Error loading stat:", err) return } - if !exists { + if !exist { return } var f *os.File @@ -394,6 +394,7 @@ func (ss *SiteStat) load(file string) (err error) { fmt.Printf("Error opening site stat %s: %v\n", file, err) return } + defer f.Close() b, err := ioutil.ReadAll(f) if err != nil { fmt.Println("Error reading site stat:", err)