MCPcopy Index your code
hub / github.com/MapServer/MapServer / msConnPoolClose

Function msConnPoolClose

mappool.c:286–330  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

284/************************************************************************/
285
286static void msConnPoolClose( int conn_index )
287
288{
289 connectionObj *conn = connections + conn_index;
290
291 if( conn->ref_count > 0 )
292 {
293 if( conn->debug )
294 msDebug( "msConnPoolClose(): "
295 "Closing connection %s even though ref_count=%d.\n",
296 conn->connection, conn->ref_count );
297
298 msSetError( MS_MISCERR,
299 "Closing connection %s even though ref_count=%d.",
300 "msConnPoolClose()",
301 conn->connection,
302 conn->ref_count );
303 }
304
305 if( conn->debug )
306 msDebug( "msConnPoolClose(%s,%p)\n",
307 conn->connection, conn->conn_handle );
308
309 if( conn->close != NULL )
310 conn->close( conn->conn_handle );
311
312 /* free malloced() stuff in this connection */
313 free( conn->connection );
314
315 connectionCount--;
316 if( connectionCount == 0 )
317 {
318 /* if there are no connections left we will "cleanup". */
319 connectionMax = 0;
320 free( connections );
321 connections = NULL;
322 }
323 else
324 {
325 /* move the last connection in place of our now closed one */
326 memcpy( connections + conn_index,
327 connections + connectionCount,
328 sizeof(connectionObj) );
329 }
330}
331
332/************************************************************************/
333/* msConnPoolRequest() */

Callers 3

msConnPoolReleaseFunction · 0.85
msConnPoolFinalCleanupFunction · 0.85

Calls 3

msDebugFunction · 0.85
msSetErrorFunction · 0.85
closeMethod · 0.45

Tested by

no test coverage detected