[tor-bugs] #27417 [Core Tor/Tor]: refactor conn_close_if_marked() in main.c

Tor Bug Tracker & Wiki blackhole at torproject.org
Fri Oct 26 01:01:03 UTC 2018


#27417: refactor conn_close_if_marked() in main.c
--------------------------+----------------------------------
 Reporter:  cyberpunks    |          Owner:  (none)
     Type:  enhancement   |         Status:  needs_revision
 Priority:  Medium        |      Milestone:  Tor: unspecified
Component:  Core Tor/Tor  |        Version:
 Severity:  Normal        |     Resolution:
 Keywords:  refactor      |  Actual Points:
Parent ID:                |         Points:
 Reviewer:  dgoulet       |        Sponsor:
--------------------------+----------------------------------

Comment (by cyberpunks):

 Replying to [comment:12 dgoulet]:
 > `    if (conn->linked_conn && retval >= 0) {`
 > `connection_start_reading_from_linked_conn(conn->linked_conn);`
 > So here is a potential problem. With this refactor, this function can be
 called ''after'' the code below here that is moved into
 `connection_flush_before_close()`.

 The point about splitting it into a pure code movement commit and then a
 separate commit is well taken. Should do that.

 That said, it's certain there's no behavior change, because if
 `conn->linked_conn` is non-NULL, it's impossible for
 `connection_wants_to_flush(conn)` to be `true` when you reach the code
 below's `if` statement, so the code below that's moved into the new
 function was never called when this is a linked connection.
 `buf_move_to_buf()` always reduces `conn->outbuf_flushlen` to zero,
 emptying the buffer entirely.

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/27417#comment:13>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list