1
0
forked from bip/bip

Initiate a 0.6.1 copy. Patch connection.c

This commit is contained in:
nohar 2007-07-16 19:48:43 +00:00
parent 3a309b0a06
commit 99ba56376a

View File

@ -54,8 +54,9 @@ void connection_close(connection_t *cn)
(long)cn->handle); (long)cn->handle);
if (cn->connected != CONN_DISCONN) { if (cn->connected != CONN_DISCONN) {
cn->connected = CONN_DISCONN; cn->connected = CONN_DISCONN;
shutdown(cn->handle, SHUT_RDWR); if (close(cn->handle) == -1)
close(cn->handle); mylog(LOG_WARN, "Error on socket close: %s",
strerror(errno));
} }
} }
@ -409,7 +410,7 @@ static int read_socket_SSL(connection_t *cn)
if (cn_is_connected(cn)) { if (cn_is_connected(cn)) {
mylog(LOG_DEBUGTOOMUCH, "fd %d: Connection lost", mylog(LOG_DEBUGTOOMUCH, "fd %d: Connection lost",
cn->handle); cn->handle);
cn->connected = CONN_DISCONN; connection_close(cn);
} }
return 1; return 1;
} }
@ -444,7 +445,7 @@ static int read_socket(connection_t *cn)
if (cn_is_connected(cn)) { if (cn_is_connected(cn)) {
mylog(LOG_DEBUGVERB, "fd %d: Connection lost", mylog(LOG_DEBUGVERB, "fd %d: Connection lost",
cn->handle); cn->handle);
cn->connected = CONN_DISCONN; connection_close(cn);
mylog(LOG_DEBUGTOOMUCH, "fd %d: read() %s", cn->handle, mylog(LOG_DEBUGTOOMUCH, "fd %d: read() %s", cn->handle,
strerror(errno)); strerror(errno));
} }
@ -1003,7 +1004,6 @@ static connection_t *connection_init(int anti_flood, int ssl, int timeout,
conn->ssl_check_mode = SSL_CHECK_NONE; conn->ssl_check_mode = SSL_CHECK_NONE;
#endif #endif
conn->connected = CONN_NEW; conn->connected = CONN_NEW;
return conn; return conn;
} }