diff options
author | dec05eba <0xdec05eba@gmail.com> | 2018-06-09 20:38:40 +0200 |
---|---|---|
committer | dec05eba <0xdec05eba@gmail.com> | 2018-06-09 20:38:44 +0200 |
commit | 69349f6bcf1a447288c04bca0b07de4ec80bb6a5 (patch) | |
tree | c52787da2deab7685013591ddb7d98aa18db3728 /src | |
parent | 1102c2c2b45672735be2b63ae5e765fb24e80838 (diff) |
Bind for rendezvous connection
Diffstat (limited to 'src')
-rw-r--r-- | src/DirectConnection.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/DirectConnection.cpp b/src/DirectConnection.cpp index e6b5645..4c14045 100644 --- a/src/DirectConnection.cpp +++ b/src/DirectConnection.cpp @@ -60,7 +60,7 @@ namespace sibs UDT::setsockopt(socket, 0, UDT_MSS, &mss, sizeof(mss)); #endif - if(bind) + if(rendezvous || bind) { if(UDT::bind(socket, (sockaddr*)&addressToBind.address, sizeof(addressToBind.address)) == UDT::ERROR) { @@ -75,15 +75,15 @@ namespace sibs void DirectConnections::connectServer(const Ipv4 &address, PubSubConnectCallback connectCallbackFunc, PubSubReceiveDataCallback receiveDataCallbackFunc) { - connect(address, false, true, connectCallbackFunc, receiveDataCallbackFunc); + connect(address, false, true, connectCallbackFunc, receiveDataCallbackFunc, false); } void DirectConnections::connect(const Ipv4 &address, PubSubConnectCallback connectCallbackFunc, PubSubReceiveDataCallback receiveDataCallbackFunc) { - connect(address, true, true, connectCallbackFunc, receiveDataCallbackFunc); + connect(address, true, true, connectCallbackFunc, receiveDataCallbackFunc, true); } - void DirectConnections::connect(const Ipv4 &address, bool rendezvous, bool reuseAddr, PubSubConnectCallback connectCallbackFunc, PubSubReceiveDataCallback receiveDataCallbackFunc) + void DirectConnections::connect(const Ipv4 &address, bool rendezvous, bool reuseAddr, PubSubConnectCallback connectCallbackFunc, PubSubReceiveDataCallback receiveDataCallbackFunc, bool bind) { std::thread([this, address, rendezvous, reuseAddr, connectCallbackFunc, receiveDataCallbackFunc]() { @@ -91,7 +91,7 @@ namespace sibs UDTSOCKET socket; try { - socket = createSocket(Ipv4(nullptr, port), rendezvous, reuseAddr, false); + socket = createSocket(Ipv4(nullptr, port), rendezvous, reuseAddr, bind); } catch(SocketCreateException &e) { |