MCPcopy Create free account
hub / github.com/SoarGroup/Soar / GetConnectionByIndex

Method GetConnectionByIndex

Core/KernelSML/src/sml_ConnectionManager.cpp:166–191  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

164}
165
166Connection* ConnectionManager::GetConnectionByIndex(int i)
167{
168 // Just to be consistent with allowing out of range values to be passed in here.
169 if (i < 0)
170 {
171 return NULL ;
172 }
173
174 // Serialize thread access to the connections list
175 // which is shared with the listener socket/thread
176 soar_thread::Lock lock(&m_ConnectionsMutex) ;
177
178 // Get the n'th connection
179 ConnectionsIter iter;
180 for (iter = m_Connections.begin() ; iter != m_Connections.end() && i > 0 ; iter++)
181 {
182 i-- ;
183 }
184
185 if (iter == m_Connections.end())
186 {
187 return NULL ;
188 }
189
190 return *iter ;
191}
192
193void ConnectionManager::RemoveConnection(Connection* pConnection)
194{

Callers 3

GetEmbeddedConnectionMethod · 0.80
HandleGetConnectionsMethod · 0.80

Calls 1

endMethod · 0.80

Tested by

no test coverage detected