Sfoglia il codice sorgente

Added Connecting state check in TcpTransport::send()

Paul-Louis Ageneau 4 anni fa
parent
commit
a61f5c20a8
1 ha cambiato i file con 3 aggiunte e 0 eliminazioni
  1. 3 0
      src/impl/tcptransport.cpp

+ 3 - 0
src/impl/tcptransport.cpp

@@ -83,6 +83,9 @@ bool TcpTransport::stop() {
 
 bool TcpTransport::send(message_ptr message) {
 	std::unique_lock lock(mSockMutex);
+	if(state() == State::Connecting)
+		throw std::runtime_error("Connection is not open");
+
 	if (state() != State::Connected)
 		return false;