Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

目前这个使用这个库对原项目似乎还是有不小的侵入性 #41

Open
lichuang opened this issue Jul 22, 2017 · 3 comments

Comments

@lichuang
Copy link

@lichuang lichuang commented Jul 22, 2017

以example_echosvr.cpp代码为例,首先没有hook系统的accept函数,需要调用自命名的co_accept函数。其次在调用co_accept返回小于0的fd的时候,需要自己手动调用co_poll。

为什么这里不对系统的accept函数进行hook,同时在调用accept函数返回小于0fd的时候,库自己内部将这个fd加入poll中呢?因为会出现这种情况,一个服务使用的是另一个二进制库,这个二进制库负责对外接收连接,无法侵入修改它的代码来适配libco的代码。

同样的问题也存在read、write等调用中,还是这个example_echosvr.cpp代码,在处理协程中,首先需要使用者调用co_poll将需要进行read操作的fd加入poll中,仍然对原有的代码造成了侵入。

@patpatbear

This comment has been minimized.

Copy link

@patpatbear patpatbear commented Sep 9, 2017

不理解为什么不对accept函数进行hook, 相信不少人有相同的疑问, 希望作者们给点提示^_^ @wechatsunny @leiffyli

@luxuan

This comment has been minimized.

Copy link

@luxuan luxuan commented Oct 29, 2017

看完example_echosvr也同样有类似的疑问:

  1. accept为什么不hook?
  2. readwrite_routine函数应该就是一个read + write的写,但里面还要和poll函数打交道?

确认这个包能和mysqlclient的编译支持协程?

@YingshuLu

This comment has been minimized.

Copy link

@YingshuLu YingshuLu commented May 27, 2018

accept 没hook的原因,估计是libco的预设应用场景是hook 第三方的client API

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.