/** * tunnel call **/ func onData(p *udppacket.Packet) int { LOG.Println("udp2tcp onData") p.LogPacket() // close packet if p.Length == 0 { releaseSession(p.SessionId, false) return 1 } s := getSession(p.SessionId) if s == nil { return -1 } //LOG.Println("udp2tcp check") s.Slock.Lock() s.ProcessNewPacketFromClientProxy(p) for { p := s.GetNextRecvDataToSend() if p == nil { LOG.Println("send data nil") break } processWrite(s, p.GetPacket()) } s.Slock.Unlock() return 0 }
/** * tunnel call * **/ func onData(p *udppacket.Packet) int { LOG.Println("tcp2udp onData") p.LogPacket() // getsession s, ok := idSessionMap[p.SessionId] if !ok { return -1 } if p.Length == 0 { releaseSession(s.GetId(), false) } // processNewPacketFromServerProxy s.Slock.Lock() s.ProcessNewPacketFromServerProxy(p) // getNextDataToSend for { p := s.GetNextRecvDataToSend() if p == nil { break } processWrite(s, p.GetPacket()) } s.Slock.Unlock() return 0 }