Example #1
0
func (g *Glue) ServeBucket() {
	for {
		conn, err := g.bcks.Accept()
		if err != nil {
			continue
		}
		bs := f2ftp.NewService(g.acc, g.bck)
		bs.Debug = g.debug
		go bs.Serve(conn)
	}
}
Example #2
0
func (g *Glue) pull(ih *relaxdht.IHaveMsg) {
	// if g.debug { fmt.Println("pull request:",ih) }
	conn, err := net.DialTCP("tcp", nil, ih.Addr)
	if err != nil {
		// if g.debug { fmt.Println("pull error:",err) }
		return
	}
	if !g.bck.Exists(ih.Id) {
		g.acc.want(ih.Id)
	}
	bs := f2ftp.NewService(g.acc, g.bck)
	bs.Debug = g.debug
	go bs.Serve(conn)
	bs.ChPull <- ih.Id
	time.Sleep(time.Second * 2)
	bs.ChQuit <- 1
	// if g.debug { fmt.Println("pull quit",ih) }
}