| skipped 505 lines |
506 | 506 | | var clientID turbotunnel.ClientID |
507 | 507 | | n = copy(clientID[:], payload) |
508 | 508 | | payload = payload[n:] |
509 | | - | if n < len(clientID) { |
| 509 | + | if n == len(clientID) { |
| 510 | + | // Discard padding and pull out the packets contained in |
| 511 | + | // the payload. |
| 512 | + | r := bytes.NewReader(payload) |
| 513 | + | for { |
| 514 | + | p, err := nextPacket(r) |
| 515 | + | if err != nil { |
| 516 | + | break |
| 517 | + | } |
| 518 | + | // Feed the incoming packet to KCP. |
| 519 | + | ttConn.QueueIncoming(p, clientID) |
| 520 | + | } |
| 521 | + | } else { |
510 | 522 | | // Payload is not long enough to contain a ClientID. |
511 | 523 | | if resp != nil && resp.Rcode() == dns.RcodeNoError { |
512 | 524 | | resp.Flags |= dns.RcodeNameError |
| skipped 6 lines |
519 | 531 | | case ch <- &record{resp, addr, clientID}: |
520 | 532 | | default: |
521 | 533 | | } |
522 | | - | } |
523 | | - | // Discard padding and pull out the packets contained in the payload. |
524 | | - | r := bytes.NewReader(payload) |
525 | | - | for { |
526 | | - | p, err := nextPacket(r) |
527 | | - | if err != nil { |
528 | | - | break |
529 | | - | } |
530 | | - | // Feed the incoming packet to KCP. |
531 | | - | ttConn.QueueIncoming(p, clientID) |
532 | 534 | | } |
533 | 535 | | } |
534 | 536 | | } |
| skipped 360 lines |