本文整理匯總了Golang中github.com/Centny/gwf/routing.HTTPSession.Printf方法的典型用法代碼示例。如果您正苦於以下問題:Golang HTTPSession.Printf方法的具體用法?Golang HTTPSession.Printf怎麽用?Golang HTTPSession.Printf使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/Centny/gwf/routing.HTTPSession
的用法示例。
在下文中一共展示了HTTPSession.Printf方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: SrvHTTP
func (v *VideoProc) SrvHTTP(hs *routing.HTTPSession) routing.HResult {
var tid string
var duration int64
err := hs.ValidCheckVal(`
tid,R|S,L:0;
duration,R|I,R:0;
`, &tid, &duration)
if err != nil {
return hs.Printf("valid argument error by %v", err)
}
var reader = bufio.NewReader(hs.R.Body)
var frame = util.Map{}
for {
bys, err := util.ReadLine(reader, 102400, false)
if err != nil {
break
}
line := strings.Trim(string(bys), " \n\t")
lines := strings.SplitN(line, "=", 2)
lines[0] = strings.Trim(lines[0], " \t")
if len(lines) < 2 {
frame[lines[0]] = ""
} else {
frame[lines[0]] = lines[1]
}
if lines[0] != "progress" {
continue
}
var progress Progress
frame.ToS(&progress)
var rate = float64(progress.OutTimeMs) / float64(duration)
if int(rate*1000)%10 == 0 {
log.D("NofityProc receive rate(%v%%) to task(%v),duration(%v)", int(rate*100), tid, duration)
}
err = v.NotifyProc(tid, rate)
if err != nil {
return hs.Printf("notify procgress to task(%v) error by %v", tid, err)
}
frame = util.Map{}
}
return hs.Printf("%v", "DONE")
}