本文整理汇总了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")
}