File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -138,6 +138,7 @@ class ChannelRequesterImpl : public ChannelRequester
138138{
139139private:
140140 Event event;
141+ bool connected = false ;
141142
142143public:
143144
@@ -167,18 +168,18 @@ class ChannelRequesterImpl : public ChannelRequester
167168 virtual void channelStateChange (const Channel::shared_pointer& /* channel*/ , Channel::ConnectionState connectionState)
168169 {
169170 if (connectionState == Channel::CONNECTED) {
170- event.signal ();
171- }
172- else {
171+ connected = true ;
172+ } else {
173173 cout << Channel::ConnectionStateNames[connectionState] << endl;
174- testFail (" Channel did not reach CONNECTED state" );
175- event.signal (); // To ensure the test does not hang
174+ connected = false ;
176175 }
176+ event.signal ();
177177 }
178178
179179 bool waitUntilConnected (double timeOut)
180180 {
181- return event.wait (timeOut);
181+ event.wait (timeOut);
182+ return connected;
182183 }
183184};
184185
@@ -210,6 +211,9 @@ static void test()
210211 Channel::shared_pointer channel = provider->createChannel (recordName, channelRequesterImpl);
211212 bool channelConnected = channelRequesterImpl->waitUntilConnected (1.0 );
212213 testOk1 (channelConnected);
214+ if (!channelConnected) {
215+ testAbort (" Channel did not reach CONNECTED state" );
216+ }
213217 if (channelConnected) {
214218 string remoteAddress = channel->getRemoteAddress ();
215219 cout << " remote address: " << remoteAddress << endl;
You can’t perform that action at this time.
0 commit comments