Skip to content

Commit

Permalink
fixed for cache.len
Browse files Browse the repository at this point in the history
  • Loading branch information
utamaro committed Sep 2, 2017
1 parent 49c2732 commit 6a751fc
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: go

go:
- 1.8
- 1.9

env:
global:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[![Build Status](https://travis-ci.org/shingetsu-gou/shingetsu-gou.svg?branch=master)](https://travis-ci.org/shingetsu-gou/shingetsu-gou)
[![GoDoc](https://godoc.org/github.com/shingetsu-gou/shingetsu-gou?status.svg)](https://godoc.org/github.com/shingetsu-gou/shingetsu-gou)
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/shingetsu-gou/shingetsu-gou/master/LICENSE)
[![GitHub license](https://img.shields.io/badge/license-BSD-blue.svg)](https://raw.githubusercontent.com/shingetsu-gou/shingetsu-gou/master/LICENSE)


# Gou(合)
Expand Down Expand Up @@ -107,7 +107,7 @@ This is for easy to use Gou; just get a binary, and run it.

## License

MIT License
3-clause BSD

Original program comes from [saku](https://github.com/shingetsu/saku), which is under [2-clause BSD license](https://github.com/shingetsu/saku/blob/master/LICENSE)
Copyrighted by 2005-2015 shinGETsu Project.
Expand Down
2 changes: 1 addition & 1 deletion cgi/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,6 @@ func SearchMessage(acceptLanguage, filedir string) Message {
}
}
}
log.Fatalf("no messages are found.")
log.Printf("no messages are found.")
return nil
}
2 changes: 1 addition & 1 deletion gou_template/remove_file_form.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<p id="status">
{{ end }}
{{ $mb:=toInt .CacheSize | toMB}}
{{printf "(%s/%d/%.1f%s)" .Title .Cache.Len $mb .Message.mb}}
{{printf "(%s/%d/%.1f%s)" .Title (.Cache.Len 0) $mb .Message.mb}}
{{ if .IsAdmin }}
</p></form>
{{ else }}
Expand Down
2 changes: 1 addition & 1 deletion gou_template/thread_bottom.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Copyright (c) 2005-2014 shinGETsu Project.
*/}}
{{define "thread_bottom"}}
{{ if .Cache.Len }}
{{ if .Cache.Len 1 }}
<p><a href="#top"
onclick="window.scroll(0,0); return false;"
onkeypress="window.scroll(0,0); return false;">{{.Message.top_of_page}}</a>
Expand Down
2 changes: 1 addition & 1 deletion gou_template/thread_top.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Copyright (c) 2005-2014 shinGETsu Project.
*/}}
{{define "thread_top"}}
{{ if and (or .IsFriend .IsAdmin) (le .Cache.Len 0) }}
{{ if and (or .IsFriend .IsAdmin) (le (.Cache.Len 0) 0) }}
<form method="get" action="{{.ThreadCGI}}/{{strEncode .Path}}"><p>
<input type="hidden" name="search_new_file" value="yes" />
<input type="submit" value="{{.Message.sync_from_network}}" class="btn" />
Expand Down
3 changes: 0 additions & 3 deletions tag/user/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ func Len(thread string) int {
return errr
})
if err != nil {
log.Print(err)
return 0
}
return len(r)
Expand Down Expand Up @@ -84,7 +83,6 @@ func Get() tag.Slice {
return err
})
if err != nil {
log.Print(err)
return nil
}
return tag.NewSlice(r)
Expand All @@ -99,7 +97,6 @@ func GetStrings(thread string) []string {
return err
})
if err != nil {
log.Print(err, thread)
return nil
}
return r
Expand Down
2 changes: 1 addition & 1 deletion thread/download/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ func getWithRange(n *node.Node, c *thread.Cache, dm *Manager) bool {
//GetCache checks nodes in lookuptable have the cache.
//if found gets records.
func GetCache(background bool, c *thread.Cache) bool {
const searchDepth = 5 // Search node size
const searchDepth = 100 // Search node size
ns := manager.NodesForGet(c.Datfile, searchDepth)
found := false
var wg sync.WaitGroup
Expand Down

0 comments on commit 6a751fc

Please sign in to comment.