Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | fix in mqtt message read handler |
---|---|
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
fcedb208a754d073c01d537ca1e5169b |
User & Date: | chw 2018-09-25 20:29:45 |
Context
2018-09-26
| ||
04:49 | add selected nanosvg upstream changes check-in: f6b5410628 user: chw tags: trunk | |
2018-09-25
| ||
20:29 | fix in mqtt message read handler check-in: fcedb208a7 user: chw tags: trunk | |
20:28 | small fix in exit handler of tkinspect check-in: f968c5fa92 user: chw tags: trunk | |
Changes
Changes to assets/mqtt1.1/mqtt.tcl.
︙ | ︙ | |||
220 221 222 223 224 225 226 | # Route timer expiry back through this method to clean up the array set timer($name) \ [after $time [list [namespace which my] timer $name expire $cmd]] return $name } } | | | | | 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 | # Route timer expiry back through this method to clean up the array set timer($name) \ [after $time [list [namespace which my] timer $name expire $cmd]] return $name } } # Convert a string to utf-8 method bin {str} { set bytes [encoding convertto utf-8 $str] return [binary format Sa* [string length $bytes] $bytes] } # Convert from utf-8 to a string method str {str} { return [encoding convertfrom utf-8 $str] } method will {topic {message ""} {qos 1} {retain 0}} { my variable connect if {$topic eq ""} { dict unset connect will } else { |
︙ | ︙ | |||
556 557 558 559 560 561 562 | binary scan $msg H* hex log "Invalid message: [regexp -all -inline .. $hex]" return } method receive {{expect {}}} { my variable fd data msgtype store | | > > > > | > > > > > | | 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 | binary scan $msg H* hex log "Invalid message: [regexp -all -inline .. $hex]" return } method receive {{expect {}}} { my variable fd data msgtype store if {[string length $data] < 1} { set byte [read $fd 1] if {[string length $byte] < 1} return append data $byte } if {[binary scan $data cu hdr] < 1} return for {set len 0; set ptr 1; set shift 0} {$ptr < 5} {incr shift 7} { if {[string length $data] <= $ptr} { set byte [read $fd 1] if {[string length $byte] < 1} return append data $byte } if {[binary scan [string index $data $ptr] cu l] != 1} return set len [expr {$len + (($l & 0x7f) << $shift)}] incr ptr if {$l < 128} break } set need [expr {$ptr + $len - [string length $data]}] append data [read $fd $need] if {[string length $data] < $ptr + $len} return set type [lindex $msgtype [expr {$hdr >> 4}]] set payload [string range $data $ptr end] set msg $data set data "" |
︙ | ︙ |