Ejemplo n.º 1
0
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()
		}
	}
}
Ejemplo n.º 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()
		}
	}
}