Browse Source

Removed SCTP transport receiving flag

Paul-Louis Ageneau 4 years ago
parent
commit
aab876d346
2 changed files with 2 additions and 5 deletions
  1. 2 4
      src/sctptransport.cpp
  2. 0 1
      src/sctptransport.hpp

+ 2 - 4
src/sctptransport.cpp

@@ -88,7 +88,7 @@ void SctpTransport::Cleanup() {
 SctpTransport::SctpTransport(std::shared_ptr<Transport> lower, uint16_t port,
                              message_callback recvCallback, amount_callback bufferedAmountCallback,
                              state_callback stateChangeCallback)
-    : Transport(lower, std::move(stateChangeCallback)), mPort(port), mReceiving(false),
+    : Transport(lower, std::move(stateChangeCallback)), mPort(port),
       mSendQueue(0, message_size_func), mBufferedAmountCallback(std::move(bufferedAmountCallback)) {
 	onRecv(recvCallback);
 
@@ -328,8 +328,6 @@ void SctpTransport::incoming(message_ptr message) {
 void SctpTransport::doRecv() {
 	std::lock_guard lock(mRecvMutex);
 	try {
-		scope_guard scope([this]() { mReceiving = false; });
-		mReceiving = true;
 		while (true) {
 			const size_t bufferSize = 65536;
 			byte buffer[bufferSize];
@@ -541,7 +539,7 @@ void SctpTransport::handleUpcall() {
 
 	int events = usrsctp_get_events(mSock);
 
-	if ((events & SCTP_EVENT_READ) && !mReceiving.exchange(true))
+	if (events & SCTP_EVENT_READ)
 		mProcessor.enqueue(&SctpTransport::doRecv, this);
 
 	if (events & SCTP_EVENT_WRITE)

+ 0 - 1
src/sctptransport.hpp

@@ -96,7 +96,6 @@ private:
 
 	Processor mProcessor;
 	std::mutex mRecvMutex, mSendMutex;
-	std::atomic<bool> mReceiving;
 	Queue<message_ptr> mSendQueue;
 	std::map<uint16_t, size_t> mBufferedAmount;
 	amount_callback mBufferedAmountCallback;