Closed learno closed 5 years ago
本质上是func和self.cobj不一致引起的,所以把cobj本地化,关闭的时候再读就可以返回正确的错误码了吧?这样改满足你的需求不?
function Socket:_recv(func, ...)
local cobj = self.cobj
while true do
local data, err = func(cobj, ...)
...
本质上是func和self.cobj不一致引起的,所以把cobj本地化,关闭的时候再读就可以返回正确的错误码了吧?这样改满足你的需求不?
function Socket:_recv(func, ...) local cobj = self.cobj while true do local data, err = func(cobj, ...) ...
可以的
更新了pr
在_recv或_send中,由于func是对应的c接口的引用,当触发close时,closed_socket会替换掉self.cobj,_wait挂起恢复后调用func会触发参数类型错误