MCPcopy Create free account
hub / github.com/alibaba/PhotonLibOS / response_sender

Method response_sender

rpc/rpc.cpp:296–317  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

294 return ret;
295 }
296 int response_sender(iovector* resp)
297 {
298 assert(w_lock);
299 Header h;
300 h.size = (uint32_t)resp->sum();
301 h.function = header.function;
302 h.tag = header.tag;
303 h.reserved = 0;
304 resp->push_front(&h, sizeof(h));
305 if (stream == nullptr)
306 LOG_ERRNO_RETURN(0, -1, "socket closed ");
307
308 w_lock->lock();
309 ssize_t ret = stream->writev(resp->iovec(), resp->iovcnt());
310 w_lock->unlock();
311
312 if (ret < (ssize_t)(sizeof(h) + h.size)) {
313 stream->shutdown(ShutdownHow::ReadWrite);
314 LOG_ERRNO_RETURN(0, -1, "failed to send rpc response to stream ", stream);
315 }
316 return 0;
317 }
318 };
319 condition_variable m_cond_served;
320 struct ThreadLink : public intrusive_list_node<ThreadLink>

Callers

nothing calls this directly

Calls 8

sumMethod · 0.45
push_frontMethod · 0.45
lockMethod · 0.45
writevMethod · 0.45
iovecMethod · 0.45
iovcntMethod · 0.45
unlockMethod · 0.45
shutdownMethod · 0.45

Tested by

no test coverage detected