View Ticket
2018-02-07
15:37
Updated to reset "eofchar" and "encoding" when importing channels as well as translation and blocking (part of [f798e2ea12]) check-in: 1d757f7e2d user: rkeene tags: trunk
2017-12-21
20:25
Merged in changes to address [f798e2ea12]. The code to manipulate the channel options may not be needed at all, we will review it to see if there are any issues with removing it altogether check-in: a811816bd3 user: rkeene tags: trunk
10:02 Ticket [f798e2ea12] TclTLS does not retain socket state when importing status still Open with 5 other changes artifact: a818c8bdc4 user: anonymous
05:34
Added experiment patch for [f798e2ea12] to preserve channel state when importing a channel Closed-Leaf check-in: 60f37290f3 user: rkeene tags: bug-f798e2ea12
2017-12-20
22:15 New ticket [f798e2ea12] TclTLS does not retain socket state when importing. artifact: b5b16a04d5 user: anonymous

Ticket Hash: f798e2ea1299e4fe603c8bdbfbfea3c2e7beb4d9
Title: TclTLS does not retain socket state when importing
Status: Open Type: Code Defect
Severity: Severe Priority: Immediate
Subsystem: Resolution: Open
Last Modified: 2017-12-21 10:02:35
Version Found In: 1.7.14
User Comments:
anonymous added on 2017-12-20 22:15:19:
11:42 <@ijchain> <rmax_> rkeene: [tls::import] appears to switch a socket that was in -blocking 0 mode before to -blocking 1.
11:44 <@ijchain> <rmax_> ... it also sets -translation to {lf lf}
11:45 <@ijchain> <rmax_> Haven't compared it with the old version yet, but -blocking 1 would explain the behaviour I am seeing.
11:47 <@ijchain> <rmax_> it also enforces -encoding binary
11:52 <@ijchain> <rmax_> Indeed, if I hack [fconfigure $sock -blocking 0 -buffering none -encoding utf-8] (copied from tkchat) into jabberlib immediately after tls::import/tls::handshake, the hang is gone.
11:53 <@ijchain> <rmax_> rkeene: I think this is a regression from the old tls package.
11:54 <@ijchain> <rmax_> [tls::import] should probably not change any [chan configure] options.
11:56 <@ijchain> <rmax_> OK, so old tls already changed -translation to lf.
11:57 <@ijchain> <rmax_> But it does retain blocking state and encoding.

anonymous added on 2017-12-21 10:02:35:
This is rmax. :)

I wonder why putting the to be imported socket in blocking mode was added at first place, but unfortunately the checkin comment doesn't tell it:

https://tcltls.rkeene.org/ci/7df7a8696e009447?sbs=1

Could it be that you added this for debugging reasons and forgot to remove it before committing?

BTW, the proposed fix only preserves the state of -translation, but -encoding and -eofchar need to be preserved as well, because setting "-translation binary" implicitly also changes these two options.