Ejemplo n.º 1
0
func (wh *ClientWormhole) ProcessPackets(dps []*wormhole.RoutePacket) {
	//gts.Trace("clientwormhole processpacket receive %d route packets",len(dps))
	for _, dp := range dps {
		gts.Debug(gutils.ByteString(dp.Data))
		//println(gutils.ByteString(dp.Data))
		//gts.Trace("%q", dp)
	}

}
Ejemplo n.º 2
0
//rule = 10,12,0
func (r *Dispatcher) AddHandler(rule []byte, wh IWormhole) {
	rules := gutils.ByteString(rule)

	rules = strings.Replace(rules, " ", "", -1)
	if len(rules) == 0 {
		r.addRule(0, wh)
		return
	}

	groups := strings.Split(rules, ",")
	gts.Trace("add disp", groups)
	for _, p_ := range groups {
		p := strings.Trim(p_, " ")
		if len(p) == 0 {
			continue
		}
		gcode, err := strconv.Atoi(p)
		if err == nil {
			r.addRule(gcode, wh)
		}
	}
	gts.Trace("messagecodemaps1:", r.handlers)
}