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

Function timeout_cb

tools/ipptool.c:4190–4220  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4188 */
4189
4190static int /* O - 1 to continue, 0 to cancel */
4191timeout_cb(http_t *http, /* I - Connection to server */
4192 void *user_data) /* I - User data (unused) */
4193{
4194 int buffered = 0; /* Bytes buffered but not yet sent */
4195
4196
4197 (void)user_data;
4198
4199 /*
4200 * If the socket still have data waiting to be sent to the printer (as can
4201 * happen if the printer runs out of paper), continue to wait until the output
4202 * buffer is empty...
4203 */
4204
4205#ifdef SO_NWRITE /* macOS and some versions of Linux */
4206 socklen_t len = sizeof(buffered); /* Size of return value */
4207
4208 if (getsockopt(httpGetFd(http), SOL_SOCKET, SO_NWRITE, &buffered, &len))
4209 buffered = 0;
4210
4211#elif defined(SIOCOUTQ) /* Others except Windows */
4212 if (ioctl(httpGetFd(http), SIOCOUTQ, &buffered))
4213 buffered = 0;
4214
4215#else /* Windows (not possible) */
4216 (void)http;
4217#endif /* SO_NWRITE */
4218
4219 return (buffered > 0);
4220}
4221
4222
4223/*

Callers

nothing calls this directly

Calls 1

httpGetFdFunction · 0.85

Tested by

no test coverage detected