Merge pull request #77 from saradickinson/tcp_resend_bug

Thanks Sara, well spotted!
Fix 2 small bugs with resending tcp data
This commit is contained in:
wtoorop 2014-10-24 22:40:44 +02:00
commit 8a8ce3431e
1 changed files with 2 additions and 2 deletions

4
src/stub.c Normal file → Executable file
View File

@ -809,11 +809,11 @@ stub_tcp_write(int fd, getdns_tcp_state *tcp, getdns_network_req *netreq)
if (!(tcp->write_buf = GETDNS_XMALLOC(
dnsreq->context->mf,uint8_t,pkt_len + 2)))
return STUB_TCP_ERROR;
(void) memcpy(pkt, pkt_buf, pkt_len + 2);
(void) memcpy(tcp->write_buf, pkt, pkt_len + 2);
tcp->write_buf_len = pkt_len + 2;
}
/* Because written could be -1 (and errno EAGAIN) */
tcp->written = written >= 0 ? written : 0;
tcp->written = (int)written >= 0 ? written : 0;
return STUB_TCP_AGAIN;