sk_err_soft和 sk_err有什么区别?
时间:2011-02-15
来源:互联网
下面是注释,这两个域是struct sock中的。
复制代码
这里注释没太看懂, 不知道这两个错误有什么区别?为什么需要sk_err_soft?
我看了内核的代码基本上是在tcp_v4_err中调用的,而这个是被ICMP模块使用的。
接下来是延伸出来的一个问题。
主要是非阻塞的句柄,我们connect的问题,下面是man手册里面的:
可以看到要使用getsockopt进行检测,在内核中getsockopt就会检测sk_err以及sk_err_soft,而这里来说肯定是检测到sk_err_soft了,因为如果有sk_err则一定会上报一个err事件的,我这里就有问题了,就是为什么不在tcp_poll(它只会检测sk_err) 里面设置错误标记位?还有就是什么时候会出现返回可写(没有出错事件),而getsockopt又能检测到错误的。我自己模拟,可是怎么都无法模拟到这种情况,不知道谁知道如何来模拟这种情况。
谢谢!
- * @sk_err: last error
- * @sk_err_soft: errors that don't cause failure but are the cause of a
- * persistent failure not just 'timed out'
我看了内核的代码基本上是在tcp_v4_err中调用的,而这个是被ICMP模块使用的。
接下来是延伸出来的一个问题。
主要是非阻塞的句柄,我们connect的问题,下面是man手册里面的:
QUOTE:
EINPROGRESS
The socket is nonblocking and the connection cannot be completed immediately. It is possible to select(2) or poll(2) for completion by
selecting the socket for writing. After select(2) indicates writability, use getsockopt(2) to read the SO_ERROR option at level SOL_SOCKET
to determine whether connect() completed successfully (SO_ERROR is zero) or unsuccessfully (SO_ERROR is one of the usual error codes listed
here, explaining the reason for the failure).
The socket is nonblocking and the connection cannot be completed immediately. It is possible to select(2) or poll(2) for completion by
selecting the socket for writing. After select(2) indicates writability, use getsockopt(2) to read the SO_ERROR option at level SOL_SOCKET
to determine whether connect() completed successfully (SO_ERROR is zero) or unsuccessfully (SO_ERROR is one of the usual error codes listed
here, explaining the reason for the failure).
可以看到要使用getsockopt进行检测,在内核中getsockopt就会检测sk_err以及sk_err_soft,而这里来说肯定是检测到sk_err_soft了,因为如果有sk_err则一定会上报一个err事件的,我这里就有问题了,就是为什么不在tcp_poll(它只会检测sk_err) 里面设置错误标记位?还有就是什么时候会出现返回可写(没有出错事件),而getsockopt又能检测到错误的。我自己模拟,可是怎么都无法模拟到这种情况,不知道谁知道如何来模拟这种情况。
谢谢!
作者: simohayha_cu 发布时间: 2011-02-15
好问题。没有相关研究,帮顶。
这个是合适的提问地方吗?
如果不合适,还有其他地方吗?
算合适,难道是没有牛人?
这个是合适的提问地方吗?
如果不合适,还有其他地方吗?
算合适,难道是没有牛人?
作者: asweisun_shan 发布时间: 2011-02-18
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28