| 269 | } |
| 270 | |
| 271 | static int anetCreateSocket(char *err, int domain) { |
| 272 | int s; |
| 273 | if ((s = socket(domain, SOCK_STREAM, 0)) == -1) { |
| 274 | anetSetError(err, "creating socket: %s", strerror(errno)); |
| 275 | return ANET_ERR; |
| 276 | } |
| 277 | |
| 278 | /* Make sure connection-intensive things like the redis benchmark |
| 279 | * will be able to close/open sockets a zillion of times */ |
| 280 | if (anetSetReuseAddr(err,s) == ANET_ERR) { |
| 281 | close(s); |
| 282 | return ANET_ERR; |
| 283 | } |
| 284 | return s; |
| 285 | } |
| 286 | |
| 287 | #define ANET_CONNECT_NONE 0 |
| 288 | #define ANET_CONNECT_NONBLOCK 1 |
no test coverage detected