+ if(to->status.send_locally)
+ choose_local_address(to, &sa, &sock);
+ if(!sa)
+ choose_udp_address(to, &sa, &sock);
+
+ bool add_srcid = (to->options >> 24) >= 4;
+ size_t overhead = 0;
+ if (add_srcid) overhead += sizeof myself->id;
+ char buf[len + overhead]; char* buf_ptr = buf;
+ if(add_srcid) {
+ memcpy(buf_ptr, &myself->id, sizeof myself->id); buf_ptr += sizeof myself->id;
+ }
+ /* TODO: if this copy turns out to be a performance concern, change sptps_send_record() to add some "pre-padding" to the buffer and use that instead */
+ memcpy(buf_ptr, data, len); buf_ptr += len;