示例#1
0
文件: receiver.go 项目: bgentry/l2met
func (r *Receiver) Accept() {
	for lreq := range r.Inbox {
		rdr := bufio.NewReader(bytes.NewReader(lreq.Body))
		for bucket := range bucket.NewBucket(lreq.Token, rdr, r.BucketSize) {
			r.Register.Lock()
			k := *bucket.Id
			_, present := r.Register.m[k]
			if !present {
				r.Register.m[k] = bucket
			} else {
				r.Register.m[k].Add(bucket)
			}
			r.Register.Unlock()
		}
	}
}
示例#2
0
func (r *Receiver) Accept() {
	for lreq := range r.Inbox {
		rdr := bufio.NewReader(bytes.NewReader(lreq.Body))
		for bucket := range bucket.NewBucket(lreq.User, lreq.Pass, rdr, lreq.Opts) {
			r.numBuckets += 1
			r.Register.Lock()
			k := *bucket.Id
			_, present := r.Register.m[k]
			if !present {
				r.Register.m[k] = bucket
			} else {
				r.Register.m[k].Add(bucket)
			}
			r.Register.Unlock()
		}
	}
}