pavel2003 opened a new issue, #2490:
URL: https://github.com/apache/brpc/issues/2490

   **Describe the bug (描述bug)**
   
   
如果Close的时候还没有设置_connected的话(stream设置的时候socket被对端关掉就会是这种场景),那么CheckConnectedAndKeepWrite里面的CHECK_GE会一直失败,打印调用栈
   
   那这个check的意义在哪呢
   
   同时问一下    // Trigger on connect to release the reference of socket
   这里的reference是对应哪里的呢,感觉stream的connect和socket不一样,没有req对应的reference吧?
   
   void Stream::Close() {
       _fake_socket_weak_ref->SetFailed();
       bthread_mutex_lock(&_connect_mutex);
       if (_closed) {
           bthread_mutex_unlock(&_connect_mutex);
           return;
       }
       _closed = true;
       if (_connected) {
           bthread_mutex_unlock(&_connect_mutex);
           return;
       }
       _connect_meta.ec = ECONNRESET;
       // Trigger on connect to release the reference of socket
       return TriggerOnConnectIfNeed();
   }
   
   
   void* Stream::RunOnConnect(void *arg) {
       ConnectMeta* meta = (ConnectMeta*)arg;
       if (meta->ec == 0) {
           meta->on_connect(Socket::STREAM_FAKE_FD, 0, meta->arg);
       } else {
           meta->on_connect(-1, meta->ec, meta->arg);
       }
       delete meta;
       return NULL;
   }
   
   
   void Socket::CheckConnectedAndKeepWrite(int fd, int err, void* data) {
       butil::fd_guard sockfd(fd);
       WriteRequest* req = static_cast<WriteRequest*>(data);
       Socket* s = req->socket;
       CHECK_GE(sockfd, 0);
   
   
   
   
   **To Reproduce (复现方法)**
   
   
   **Expected behavior (期望行为)**
   
   
   **Versions (各种版本)**
   OS:
   Compiler:
   brpc:
   protobuf:
   
   **Additional context/screenshots (更多上下文/截图)**
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to