Archived
1
0

Merge branch 'master' of ssh://github.com/majestrate/nntpchan

This commit is contained in:
Jeff Becker 2018-02-13 06:51:10 -05:00
commit e9507505af
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

View File

@ -1324,13 +1324,13 @@ func (self *nntpConnection) scrapeGroup(daemon *NNTPDaemon, conn *textproto.Conn
// success // success
es, lo, hi, _ := interpretGroupResult(ret) es, lo, hi, _ := interpretGroupResult(ret)
for { for {
if lo < hi { if lo > hi {
// server indicated empty group // server indicated empty group
// or // or
// we finished pulling stuff // we finished pulling stuff
break break
} }
if lo-hi+1 <= maxXOVERRange { if hi-lo+1 <= maxXOVERRange {
// not too much for us to pull // not too much for us to pull
if es == 0 && lo == 0 && hi == 0 { if es == 0 && lo == 0 && hi == 0 {
// empty group // empty group
@ -1372,6 +1372,11 @@ func (self *nntpConnection) scrapeGroup(daemon *NNTPDaemon, conn *textproto.Conn
msgid := parts[4] msgid := parts[4]
// msgid -> reference // msgid -> reference
articles[msgid] = parts[5] articles[msgid] = parts[5]
// incase server returned more articles than we requested
if num, nerr := strconv.ParseUint(parts[0], 10, 64); nerr == nil && num >= lo {
// fix lo so that we wont request them again
lo = num + 1
}
} else { } else {
// probably not valid line // probably not valid line
// ignore // ignore
@ -1395,8 +1400,8 @@ func (self *nntpConnection) scrapeGroup(daemon *NNTPDaemon, conn *textproto.Conn
if err != nil { if err != nil {
// something bad happened // something bad happened
log.Println(self.name, "failed to obtain root post", refid, err) log.Println(self.name, "failed to obtain root post", refid, err)
// trying with another article isn't bad idea // it fails only when REALLY bad stuff happens
err = nil return
} }
} }
} }
@ -1413,8 +1418,8 @@ func (self *nntpConnection) scrapeGroup(daemon *NNTPDaemon, conn *textproto.Conn
if err != nil { if err != nil {
// something bad happened // something bad happened
log.Println(self.name, "failed to obtain article", msgid, err) log.Println(self.name, "failed to obtain article", msgid, err)
// trying with another article isn't bad idea // it fails only when REALLY bad stuff happens
err = nil return
} }
} }
} }