TangSiyang2001 commented on issue #2145:
URL: https://github.com/apache/brpc/issues/2145#issuecomment-1467645632

   > 这个只提供同步接口么?
   
   我们是否可以采用将`done`传入progressive 
reader的方式来实现异步接口,然用户在合适的时候适时调用done->Run()?如果可行那么目前的设计可以cover这种方式。
   ***
   > 这个应该是一个method级别的option。或者至少得是service级别。 
不能是server级别。不然加了这个参数之后,一些service会出现undefined behavior.
   
   
确实如此,本计划实现method级别的option,但暂时没有想到比较理想的方式,由于调用时序的关系,只有在ProcessHttpRequest被调用后,才能确定调用的method。
   见ProcessHttpRequest
   ```cpp
   const Server::MethodProperty* const sp =
           FindMethodPropertyByURI(path, server, &req_header._unresolved_path);
   // ...
   google::protobuf::Service* svc = sp->service;
   const google::protobuf::MethodDescriptor* method = sp->method;
   ```
   而是否以progressive方式读取取决于socket层的设置,应在相应socket建立之前就确定下来,即需要在`Socket::Create`中调用
   ```cpp
   m->read_will_be_progressive(CONNECTION_TYPE_SHORT);
   ```
   该调用时机显然在ProcessHttpRequest之前,因此认为难以设计method级别的option。service级别的option原因类似。
   ***
   >为什么需要改acceptor? 这个不应该是socket级别的东西么? 
应该只影响ProcessHttpRequest相关的吧,如果需要可以在对应的socket或者messenger里面加一些数据。
   
   如果按照以上需要在`Socket::Create`中调用
   ```cpp
   m->read_will_be_progressive(CONNECTION_TYPE_SHORT);
   ```
   
的准则,那么需要在`Acceptor::OnNewConnectionsUntilEAGAIN`调用`Socket::Create`之前传入相应的SocketOption,而按原先的设计,就需要在Acceptor中记录相应的ServerOption,以在其创建Socket时能设置正确的SocketOption
   


-- 
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