[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] warn more when losing data on closed/marked connections.
Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/tmp/cvs-serv8297/src/or
Modified Files:
connection.c main.c
Log Message:
warn more when losing data on closed/marked connections.
Index: connection.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection.c,v
retrieving revision 1.169
retrieving revision 1.170
diff -u -d -r1.169 -r1.170
--- connection.c 3 Mar 2004 01:58:45 -0000 1.169
+++ connection.c 3 Mar 2004 02:07:57 -0000 1.170
@@ -153,6 +153,10 @@
log_fn(LOG_WARN,"Attempt to close already-closed connection.");
return;
}
+ if (conn->outbuf_flushlen) {
+ log_fn(LOG_INFO,"Closing connection (fd %d, type %d, state %d) with data on outbuf.",
+ conn->s, conn->type, conn->state);
+ }
close(conn->s);
conn->s = -1;
if(!connection_is_listener(conn)) {
Index: main.c
===================================================================
RCS file: /home/or/cvsroot/src/or/main.c,v
retrieving revision 1.184
retrieving revision 1.185
diff -u -d -r1.184 -r1.185
--- main.c 2 Mar 2004 17:48:16 -0000 1.184
+++ main.c 3 Mar 2004 02:07:57 -0000 1.185
@@ -229,18 +229,23 @@
assert_connection_ok(conn, time(NULL));
if(conn->marked_for_close) {
log_fn(LOG_INFO,"Cleaning up connection (fd %d).",conn->s);
- if(conn->s >= 0) {
+ if(conn->s >= 0 && connection_wants_to_flush(conn)) {
/* -1 means it's an incomplete edge connection, or that the socket
* has already been closed as unflushable. */
/* FIXME there's got to be a better way to check for this -- and make other checks? */
+ log_fn(LOG_WARN,
+ "Conn (fd %d, type %d, state %d) marked for close, but wants to flush.",
+ conn->s, conn->type, conn->state);
+
if(connection_speaks_cells(conn)) {
- if(conn->state == OR_CONN_STATE_OPEN)
+ if(conn->state == OR_CONN_STATE_OPEN && conn->outbuf_flushlen) {
flush_buf_tls(conn->tls, conn->outbuf, &conn->outbuf_flushlen);
+ }
} else {
flush_buf(conn->s, conn->outbuf, &conn->outbuf_flushlen);
}
if(connection_wants_to_flush(conn) && buf_datalen(conn->outbuf)) {
- log_fn(LOG_WARN,"Conn (socket %d) still wants to flush. Losing %d bytes!",
+ log_fn(LOG_WARN,"Conn (fd %d) still wants to flush. Losing %d bytes!",
conn->s, (int)buf_datalen(conn->outbuf));
}
}