25 November 2020: Wouter
- with udp-connect ignore connection refused with UDP timeouts.
+ - Fix udp-connect on FreeBSD, do send calls on connected UDP socket.
24 November 2020: Wouter
- Merge PR #283 : Stream reuse. This implements upstream stream
log_assert(pend->pc && pend->pc->cp);
/* send it over the commlink */
- if(!comm_point_send_udp_msg(pend->pc->cp, packet,
- (struct sockaddr*)&pend->addr, pend->addrlen)) {
- portcomm_loweruse(outnet, pend->pc);
- return 0;
+ if(outnet->udp_connect) {
+ if(!comm_point_send_udp_msg(pend->pc->cp, packet, NULL, 0)) {
+ portcomm_loweruse(outnet, pend->pc);
+ return 0;
+ }
+ } else {
+ if(!comm_point_send_udp_msg(pend->pc->cp, packet,
+ (struct sockaddr*)&pend->addr, pend->addrlen)) {
+ portcomm_loweruse(outnet, pend->pc);
+ return 0;
+ }
}
/* system calls to set timeout after sending UDP to make roundtrip
if(sldns_buffer_remaining(packet) == 0)
log_err("error: send empty UDP packet");
#endif
- log_assert(addr && addrlen > 0);
- sent = sendto(c->fd, (void*)sldns_buffer_begin(packet),
- sldns_buffer_remaining(packet), 0,
- addr, addrlen);
+ if(addr) {
+ log_assert(addr && addrlen > 0);
+ sent = sendto(c->fd, (void*)sldns_buffer_begin(packet),
+ sldns_buffer_remaining(packet), 0,
+ addr, addrlen);
+ } else {
+ sent = send(c->fd, (void*)sldns_buffer_begin(packet),
+ sldns_buffer_remaining(packet), 0);
+ }
if(sent == -1) {
/* try again and block, waiting for IO to complete,
* we want to send the answer, and we will wait for
* Send an udp message over a commpoint.
* @param c: commpoint to send it from.
* @param packet: what to send.
- * @param addr: where to send it to.
+ * @param addr: where to send it to. If NULL, send is performed,
+ * for connected sockets, to the connected address.
* @param addrlen: length of addr.
* @return: false on a failure.
*/