linux下zeromq write函数变更
来源:互联网 发布:设备维修保养软件 编辑:程序博客网 时间:2024/05/19 04:51
文件tcp_socket.cpp中write函数发生变更,可以去github上看master版本的src/tcp_socket.cpp 点这里前往github
说下影响,在之前2.2.0版本,其实write函数是这样的
int zmq::tcp_socket_t::write (const void *data, int size){ ssize_t nbytes = send (s, data, size, 0); // Several errors are OK. When speculative write is being done we may not // be able to write a single byte to the socket. Also, SIGSTOP issued // by a debugging tool can result in EINTR error. if (nbytes == -1 && (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR)) return 0; // Signalise peer failure. if (nbytes == -1 && (errno == ECONNRESET || errno == EPIPE)) return -1; errno_assert (nbytes != -1); return (size_t) nbytes;}
然后在我以前另外一篇文章中有提到过zeromq需要注意的一些细节中有说到很容易碰到connection timeout的错误并告知怎么更改。
最近有碰到在write的时候发生Connection refused错误也就是errno是ECONNREFUSED,还正在想自己加个过滤算了,不过去了github上看了下最新代码,发现代码变更了
对错误处理的更加友好,而不会向之前对一些比较容易发生的错误直接中断。
下面这部分是直接文本copy过来的。
200- if (nbytes == -1201
- && (errno == ECONNRESET202
- || errno == EPIPE203
- || errno == ETIMEDOUT))200
+ if (nbytes == -1) {201
+ errno_assert (errno != EACCES202
+ && errno != EBADF203
+ && errno != EDESTADDRREQ204
+ && errno != EFAULT205
+ && errno != EINVAL206
+ && errno != EISCONN207
+ && errno != EMSGSIZE208
+ && errno != ENOMEM209
+ && errno != ENOTSOCK210
+ && errno != EOPNOTSUPP);204211
return -1;212
+ }205213
206
- errno_assert (nbytes != -1);207214
return (size_t) nbytes;208215
}
- linux下zeromq write函数变更
- linux下 open() write() read() close函数
- linux下 open() write() read() close函数
- linux下 open() write() read() close函数
- linux下 open() write() read() close函数
- linux下 open() write() read() close函数
- Linux下的read,write函数
- linux下 open() write() read() close函数
- linux下 open() write() read() close函数
- linux下 open() write() read() close函数
- linux下 open() write() read() close函数
- LINUX下 ZeroMQ安装实例
- linux之write函数
- linux write函数
- linux之write函数
- linux文件函数-write
- linux下的open()read()write()close()lseek()函数
- [转载]linux下 open() write() read() close函数
- win7系统下IIS7的配置
- C - 函数调用的栈分配
- centos 升级gcc
- github快速使用指南—git学习笔记
- java获取字节的长度
- linux下zeromq write函数变更
- ios中navigation相关的视图切换
- 提高代码质量:代码审查
- 关于count(*)得 非聚合索引 性能大于聚合索引性能研究
- 加速Web开发的9款知名HTML5框架
- “小和大”--逍遥游篇1--庄子南华(南怀瑾老师)
- c#将pdf文件转换成flash swf
- hdu - 1879 - 继续畅通工程
- 文本框样式 收录 已测试