Summary

tcp-abandon-port polarity reversed, I think

Metadata

Description

To my understanding, (tcp-abandon-port x) is supposed to signal that port X should not be shutdown() when we close the Scheme port. If so, I think tcp-abandon-port is abandoning the wrong port, because it does:

  if input port: set slot 2 to #t
  if output port: set slot 1 to #t

but the close procedure does

 if input port and slot 1 #t: ignore shutdown
 if output port and slot 2 #t: ignore shutdown

tcp-abandon-port checks input/output port using (##sys#slot p 1) and I think that is where the bug is -- when #t, it sets slot 2, but #t means input-port.

To reproduce, do something like

 (define-values (i o) (tcp-connect "3e8.org" 80))
 (tcp-abandon-port o)
 (close-output-port o)

and note that the connection is closed even though the input port is still open.

If this analysis is incorrect, I would appreciate an explanation of what the heck tcp-abandon-port is supposed to do!

Changes and comments

[2011-02-09 11:15:20 UTC] felix changed status from new to assigned

[2011-02-09 11:15:20 UTC] felix changed owner from felix to zbigniew

[2011-02-09 11:15:20 UTC] felix wrote:

Yes, this seems to be the case. I changed this in `tcp-abandon-port` (experimental). I would be positively delighted if you could find the time to put it once again under your stern scrutiny.

Therefore I remain,

your most obedient servant, Felix Winkelmann

[2011-02-09 17:50:06 UTC] zbigniew changed status from assigned to closed

[2011-02-09 17:50:06 UTC] zbigniew set resolution to fixed

[2011-02-09 17:50:06 UTC] zbigniew wrote:

Thanks Felix. I've already tested this fix previously, so I know it behaves properly (for my definition of properly!)

[2011-06-01 09:00:41 UTC] felix changed milestone from 4.7.0 to 4.8.0

[2011-06-01 09:00:41 UTC] felix wrote:

Milestone 4.7.0 deleted

[2012-09-24 21:47:48 UTC] felix changed milestone from 4.8.0 to 4.9.0

[2012-09-24 21:47:48 UTC] felix wrote:

Milestone 4.8.0 deleted