Deleted
Added
nxt_socket.c (1082:6cf42ea4b90e) | nxt_socket.c (1263:f3e5fa1fc962) |
---|---|
1 2/* 3 * Copyright (C) Igor Sysoev 4 * Copyright (C) NGINX, Inc. 5 */ 6 7#include <nxt_main.h> 8 --- 286 unchanged lines hidden (view full) --- 295 default: 296 level = NXT_LOG_ALERT; 297 } 298 299 nxt_log(task, level, "shutdown(%d, %ui) failed %E", s, how, err); 300} 301 302 | 1 2/* 3 * Copyright (C) Igor Sysoev 4 * Copyright (C) NGINX, Inc. 5 */ 6 7#include <nxt_main.h> 8 --- 286 unchanged lines hidden (view full) --- 295 default: 296 level = NXT_LOG_ALERT; 297 } 298 299 nxt_log(task, level, "shutdown(%d, %ui) failed %E", s, how, err); 300} 301 302 |
303nxt_err_t 304nxt_socket_error(nxt_socket_t s) 305{ 306 int ret, err; 307 socklen_t len; 308 309 err = 0; 310 len = sizeof(int); 311 /* 312 * Linux and BSDs return 0 and store a pending error in the err argument; 313 * Solaris returns -1 and sets the errno. 314 */ 315 ret = getsockopt(s, SOL_SOCKET, SO_ERROR, (void *) &err, &len); 316 317 if (nxt_slow_path(ret == -1)) { 318 err = nxt_errno; 319 } 320 321 return err; 322} 323 324 |
|
303nxt_uint_t 304nxt_socket_error_level(nxt_err_t err) 305{ 306 switch (err) { 307 308 case NXT_EPIPE: 309 case NXT_ECONNRESET: 310 case NXT_ENOTCONN: 311 case NXT_ETIMEDOUT: 312 case NXT_ENETDOWN: 313 case NXT_ENETUNREACH: 314 case NXT_EHOSTDOWN: 315 case NXT_EHOSTUNREACH: 316 return NXT_LOG_INFO; 317 318 default: 319 return NXT_LOG_ALERT; 320 } 321} | 325nxt_uint_t 326nxt_socket_error_level(nxt_err_t err) 327{ 328 switch (err) { 329 330 case NXT_EPIPE: 331 case NXT_ECONNRESET: 332 case NXT_ENOTCONN: 333 case NXT_ETIMEDOUT: 334 case NXT_ENETDOWN: 335 case NXT_ENETUNREACH: 336 case NXT_EHOSTDOWN: 337 case NXT_EHOSTUNREACH: 338 return NXT_LOG_INFO; 339 340 default: 341 return NXT_LOG_ALERT; 342 } 343} |