MCPcopy Create free account
hub / github.com/OpenPrinting/cups / cupsdCloseClient

Function cupsdCloseClient

scheduler/client.c:412–560  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

410 */
411
412int /* O - 1 if partial close, 0 if fully closed */
413cupsdCloseClient(cupsd_client_t *con) /* I - Client to close */
414{
415 int partial; /* Do partial close for SSL? */
416
417
418 cupsdLogClient(con, CUPSD_LOG_DEBUG, "Closing connection.");
419
420 /*
421 * Flush pending writes before closing...
422 */
423
424 httpFlushWrite(con->http);
425
426 partial = 0;
427
428 if (con->pipe_pid != 0)
429 {
430 /*
431 * Stop any CGI process...
432 */
433
434 cupsdEndProcess(con->pipe_pid, 1);
435 con->pipe_pid = 0;
436 }
437
438 if (con->file >= 0)
439 {
440 cupsdRemoveSelect(con->file);
441
442 close(con->file);
443 con->file = -1;
444 }
445
446 if (con->bg_pending)
447 {
448 /*
449 * Don't close connection when there is a background thread pending
450 */
451 partial = 1;
452 }
453
454 /*
455 * Close the socket and clear the file from the input set for select()...
456 */
457
458 if (httpGetFd(con->http) >= 0)
459 {
460 cupsArrayRemove(ActiveClients, con);
461 cupsdSetBusyState(0);
462
463#ifdef HAVE_TLS
464 /*
465 * Shutdown encryption as needed...
466 */
467
468 if (httpIsEncrypted(con->http))
469 partial = 1;

Callers 4

cupsdCloseAllClientsFunction · 0.85
cupsdReadClientFunction · 0.85
cupsdWriteClientFunction · 0.85
mainFunction · 0.85

Calls 15

cupsdLogClientFunction · 0.85
httpFlushWriteFunction · 0.85
cupsdEndProcessFunction · 0.85
cupsdRemoveSelectFunction · 0.85
httpGetFdFunction · 0.85
cupsArrayRemoveFunction · 0.85
cupsdSetBusyStateFunction · 0.85
httpIsEncryptedFunction · 0.85
httpErrorFunction · 0.85
httpShutdownFunction · 0.85
cupsdAddSelectFunction · 0.85
httpCloseFunction · 0.85

Tested by

no test coverage detected