Fix 2 small bugs with resending tcp data

This commit is contained in:
saradickinson 2014-10-24 14:38:22 +00:00
parent 2fe5a51dd4
commit c5d63ed9d7
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;