MCPcopy Create free account
hub / github.com/apache/qpid-proton / pconnection_write

Function pconnection_write

c/src/proactor/win_iocp.cpp:2234–2253  ·  view source on GitHub ↗

Return true unless reaped

Source from the content-addressed store, hash-verified

2232
2233// Return true unless reaped
2234static bool pconnection_write(pconnection_t *pc, pn_bytes_t wbuf) {
2235 ssize_t n;
2236 bool wouldblock;
2237 {
2238 csguard g(&pc->context.proactor->write_lock);
2239 n = pni_iocp_begin_write(pc->psocket.iocpd, wbuf.start, wbuf.size, &wouldblock, pc->psocket.iocpd->error);
2240 }
2241 if (n > 0) {
2242 pn_connection_driver_write_done(&pc->driver, n);
2243 } else if (n < 0 && !wouldblock) {
2244 psocket_error(&pc->psocket, WSAGetLastError(), "on write to");
2245 }
2246 else if (wbuf.size == 0 && pn_connection_driver_write_closed(&pc->driver)) {
2247 if (pc->context.proactor->reaper->add(pc->psocket.iocpd)) {
2248 pc->psocket.iocpd = NULL;
2249 return false;
2250 }
2251 }
2252 return true;
2253}
2254
2255// Queue the result (if any) for the one worker thread. Become the worker if possible.
2256// NULL result is a wakeup or a topup.

Callers 1

pconnection_processFunction · 0.70

Calls 5

pni_iocp_begin_writeFunction · 0.70
psocket_errorFunction · 0.70
addMethod · 0.45

Tested by

no test coverage detected