Projects STRLCPY dnstt Commits 4663433c
🤬
  • Do receive-triggered polls based packets received.

    Not amount of raw payload. This allows for the case where the received
    payload is only padding, for example. (That can't happen with the
    current downstream encoding scheme, which doesn't allow for padding, so
    I believe this change results in equivalent behavior.)
  • Loading...
  • David Fifield committed 4 years ago
    4663433c
    1 parent 05444dcb
  • ■ ■ ■ ■ ■ ■
    dnstt-client/dns.go
    skipped 190 lines
    191 191   }
    192 192   
    193 193   payload := dnsResponsePayload(&resp, c.domain)
    194  - // Reading anything gives sendLoop license to poll immediately.
    195  - if len(payload) > 0 {
    196  - select {
    197  - case c.pollChan <- struct{}{}:
    198  - default:
    199  - }
    200  - select {
    201  - case c.pollChan <- struct{}{}:
    202  - default:
    203  - }
    204  - }
    205 194   
    206 195   // Pull out the packets contained in the payload.
    207 196   r := bytes.NewReader(payload)
     197 + any := false
    208 198   for {
    209 199   p, err := nextPacket(r)
    210 200   if err != nil {
    211 201   break
    212 202   }
     203 + any = true
    213 204   c.QueuePacketConn.QueueIncoming(p, addr)
     205 + }
     206 + 
     207 + // If the payload contained one or more packets, permit sendLoop
     208 + // to poll immediately.
     209 + if any {
     210 + select {
     211 + case c.pollChan <- struct{}{}:
     212 + default:
     213 + }
     214 + select {
     215 + case c.pollChan <- struct{}{}:
     216 + default:
     217 + }
    214 218   }
    215 219   }
    216 220  }
    skipped 167 lines
Please wait...
Page is in error, reload to recover