MCPcopy Create free account
hub / github.com/apache/brpc / TriggerOnConnectIfNeed

Method TriggerOnConnectIfNeed

src/brpc/stream.cpp:309–324  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

307}
308
309void Stream::TriggerOnConnectIfNeed() {
310 if (_connect_meta.on_connect != NULL) {
311 ConnectMeta* meta = new ConnectMeta;
312 meta->on_connect = _connect_meta.on_connect;
313 meta->arg = _connect_meta.arg;
314 meta->ec = _connect_meta.ec;
315 bthread_mutex_unlock(&_connect_mutex);
316 bthread_t tid;
317 if (bthread_start_urgent(&tid, &BTHREAD_ATTR_NORMAL, RunOnConnect, meta) != 0) {
318 LOG(FATAL) << "Fail to start bthread, " << berror();
319 RunOnConnect(meta);
320 }
321 return;
322 }
323 bthread_mutex_unlock(&_connect_mutex);
324}
325
326int Stream::AppendIfNotFull(const butil::IOBuf &data,
327 const StreamWriteOptions* options) {

Callers

nothing calls this directly

Calls 3

bthread_mutex_unlockFunction · 0.85
bthread_start_urgentFunction · 0.85
berrorFunction · 0.85

Tested by

no test coverage detected