This commit is contained in:
esrrhs 2019-11-01 18:44:15 +08:00
parent 8d1d2bd6a2
commit 30b1cd117b
2 changed files with 18 additions and 1 deletions

View File

@ -557,6 +557,7 @@ func (p *Client) processPacket(packet *Packet) {
clientConn := p.getClientConnById(packet.my.Id) clientConn := p.getClientConnById(packet.my.Id)
if clientConn == nil { if clientConn == nil {
loggo.Debug("processPacket no conn %s ", packet.my.Id) loggo.Debug("processPacket no conn %s ", packet.my.Id)
p.remoteError(packet.my.Id)
return return
} }
@ -711,3 +712,10 @@ func (p *Client) deleteClientConn(uuid string, addr string) {
p.localIdToConnMap.Delete(uuid) p.localIdToConnMap.Delete(uuid)
p.localAddrToConnMap.Delete(addr) p.localAddrToConnMap.Delete(addr)
} }
func (p *Client) remoteError(uuid string) {
sendICMP(p.id, p.sequence, *p.conn, p.ipaddrServer, "", uuid, (uint32)(MyMsg_KICK), []byte{},
SEND_PROTO, RECV_PROTO, p.key,
0, 0, 0, 0, 0, 0,
0)
}

View File

@ -114,6 +114,15 @@ func (p *Server) processPacket(packet *Packet) {
return return
} }
if packet.my.Type == (int32)(MyMsg_KICK) {
localConn := p.getServerConnById(packet.my.Id)
if localConn != nil {
p.close(localConn)
loggo.Info("remote kick local %s", packet.my.Id)
}
return
}
loggo.Debug("processPacket %s %s %d", packet.my.Id, packet.src.String(), len(packet.my.Data)) loggo.Debug("processPacket %s %s %d", packet.my.Id, packet.src.String(), len(packet.my.Data))
now := time.Now() now := time.Now()
@ -491,7 +500,7 @@ func (p *Server) deleteServerConn(uuid string) {
} }
func (p *Server) remoteError(uuid string, packet *Packet) { func (p *Server) remoteError(uuid string, packet *Packet) {
sendICMP(packet.echoId, packet.echoSeq, *p.conn, packet.src, "", uuid, (uint32)(MyMsg_KICK), packet.my.Data, sendICMP(packet.echoId, packet.echoSeq, *p.conn, packet.src, "", uuid, (uint32)(MyMsg_KICK), []byte{},
(int)(packet.my.Rproto), -1, p.key, (int)(packet.my.Rproto), -1, p.key,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0) 0)