8 May 2017: Wouter
- Fix tcp-mss failure printout text.
+ - Set SO_REUSEADDR on outgoing tcp connections to fix the bind before
+ connect limited tcp connections. With the option tcp connections
+ can share the same source port (for different destinations).
2 May 2017: Ralph
- Added mesh_add_sub to add detached mesh entries.
{
struct pending_tcp* pend = w->outnet->tcp_free;
int s;
+#ifdef SO_REUSEADDR
+ int on = 1;
+#endif
log_assert(pend);
log_assert(pkt);
log_assert(w->addrlen > 0);
return 0;
}
+#ifdef SO_REUSEADDR
+ if(setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (void*)&on,
+ (socklen_t)sizeof(on)) < 0) {
+ verbose(VERB_ALGO, "outgoing tcp:"
+ " setsockopt(.. SO_REUSEADDR ..) failed");
+ }
+#endif
if (w->outnet->tcp_mss > 0) {
#if defined(IPPROTO_TCP) && defined(TCP_MAXSEG)
if(setsockopt(s, IPPROTO_TCP, TCP_MAXSEG,