"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tests/support/redis.tcl" between
redis-6.2.4.tar.gz and redis-6.2.5.tar.gz

About: redis is an advanced key-value store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets and sorted sets.

redis.tcl  (redis-6.2.4):redis.tcl  (redis-6.2.5)
skipping to change at line 37 skipping to change at line 37
package require Tcl 8.5 package require Tcl 8.5
package provide redis 0.1 package provide redis 0.1
namespace eval redis {} namespace eval redis {}
set ::redis::id 0 set ::redis::id 0
array set ::redis::fd {} array set ::redis::fd {}
array set ::redis::addr {} array set ::redis::addr {}
array set ::redis::blocking {} array set ::redis::blocking {}
array set ::redis::deferred {} array set ::redis::deferred {}
array set ::redis::readraw {}
array set ::redis::reconnect {} array set ::redis::reconnect {}
array set ::redis::tls {} array set ::redis::tls {}
array set ::redis::callback {} array set ::redis::callback {}
array set ::redis::state {} ;# State in non-blocking reply reading array set ::redis::state {} ;# State in non-blocking reply reading
array set ::redis::statestack {} ;# Stack of states, for nested mbulks array set ::redis::statestack {} ;# Stack of states, for nested mbulks
proc redis {{server 127.0.0.1} {port 6379} {defer 0} {tls 0} {tlsoptions {}}} { proc redis {{server 127.0.0.1} {port 6379} {defer 0} {tls 0} {tlsoptions {}} {re adraw 0}} {
if {$tls} { if {$tls} {
package require tls package require tls
::tls::init \ ::tls::init \
-cafile "$::tlsdir/ca.crt" \ -cafile "$::tlsdir/ca.crt" \
-certfile "$::tlsdir/client.crt" \ -certfile "$::tlsdir/client.crt" \
-keyfile "$::tlsdir/client.key" \ -keyfile "$::tlsdir/client.key" \
{*}$tlsoptions {*}$tlsoptions
set fd [::tls::socket $server $port] set fd [::tls::socket $server $port]
} else { } else {
set fd [socket $server $port] set fd [socket $server $port]
} }
fconfigure $fd -translation binary fconfigure $fd -translation binary
set id [incr ::redis::id] set id [incr ::redis::id]
set ::redis::fd($id) $fd set ::redis::fd($id) $fd
set ::redis::addr($id) [list $server $port] set ::redis::addr($id) [list $server $port]
set ::redis::blocking($id) 1 set ::redis::blocking($id) 1
set ::redis::deferred($id) $defer set ::redis::deferred($id) $defer
set ::redis::readraw($id) $readraw
set ::redis::reconnect($id) 0 set ::redis::reconnect($id) 0
set ::redis::tls($id) $tls set ::redis::tls($id) $tls
::redis::redis_reset_state $id ::redis::redis_reset_state $id
interp alias {} ::redis::redisHandle$id {} ::redis::__dispatch__ $id interp alias {} ::redis::redisHandle$id {} ::redis::__dispatch__ $id
} }
# This is a wrapper to the actual dispatching procedure that handles # This is a wrapper to the actual dispatching procedure that handles
# reconnection if needed. # reconnection if needed.
proc ::redis::__dispatch__ {id method args} { proc ::redis::__dispatch__ {id method args} {
set errorcode [catch {::redis::__dispatch__raw__ $id $method $args} retval] set errorcode [catch {::redis::__dispatch__raw__ $id $method $args} retval]
skipping to change at line 161 skipping to change at line 163
proc ::redis::__method__flush {id fd} { proc ::redis::__method__flush {id fd} {
flush $fd flush $fd
} }
proc ::redis::__method__close {id fd} { proc ::redis::__method__close {id fd} {
catch {close $fd} catch {close $fd}
catch {unset ::redis::fd($id)} catch {unset ::redis::fd($id)}
catch {unset ::redis::addr($id)} catch {unset ::redis::addr($id)}
catch {unset ::redis::blocking($id)} catch {unset ::redis::blocking($id)}
catch {unset ::redis::deferred($id)} catch {unset ::redis::deferred($id)}
catch {unset ::redis::readraw($id)}
catch {unset ::redis::reconnect($id)} catch {unset ::redis::reconnect($id)}
catch {unset ::redis::tls($id)} catch {unset ::redis::tls($id)}
catch {unset ::redis::state($id)} catch {unset ::redis::state($id)}
catch {unset ::redis::statestack($id)} catch {unset ::redis::statestack($id)}
catch {unset ::redis::callback($id)} catch {unset ::redis::callback($id)}
catch {interp alias {} ::redis::redisHandle$id {}} catch {interp alias {} ::redis::redisHandle$id {}}
} }
proc ::redis::__method__channel {id fd} { proc ::redis::__method__channel {id fd} {
return $fd return $fd
} }
proc ::redis::__method__deferred {id fd val} { proc ::redis::__method__deferred {id fd val} {
set ::redis::deferred($id) $val set ::redis::deferred($id) $val
} }
proc ::redis::__method__readraw {id fd val} {
set ::redis::readraw($id) $val
}
proc ::redis::redis_write {fd buf} { proc ::redis::redis_write {fd buf} {
puts -nonewline $fd $buf puts -nonewline $fd $buf
} }
proc ::redis::redis_writenl {fd buf} { proc ::redis::redis_writenl {fd buf} {
redis_write $fd $buf redis_write $fd $buf
redis_write $fd "\r\n" redis_write $fd "\r\n"
flush $fd flush $fd
} }
skipping to change at line 243 skipping to change at line 250
proc ::redis::redis_read_line fd { proc ::redis::redis_read_line fd {
string trim [gets $fd] string trim [gets $fd]
} }
proc ::redis::redis_read_null fd { proc ::redis::redis_read_null fd {
gets $fd gets $fd
return {} return {}
} }
proc ::redis::redis_read_bool fd {
set v [redis_read_line $fd]
if {$v == "t"} {return 1}
if {$v == "f"} {return 0}
return -code error "Bad protocol, '$v' as bool type"
}
proc ::redis::redis_read_reply {id fd} { proc ::redis::redis_read_reply {id fd} {
set type [read $fd 1] if {$::redis::readraw($id)} {
switch -exact -- $type { return [redis_read_line $fd]
_ {redis_read_null $fd} }
: -
+ {redis_read_line $fd} while {1} {
, {expr {double([redis_read_line $fd])}} set type [read $fd 1]
- {return -code error [redis_read_line $fd]} switch -exact -- $type {
$ {redis_bulk_read $fd} _ {return [redis_read_null $fd]}
> - : -
~ - ( -
* {redis_multi_bulk_read $id $fd} + {return [redis_read_line $fd]}
% {redis_read_map $id $fd} , {return [expr {double([redis_read_line $fd])}]}
default { # {return [redis_read_bool $fd]}
if {$type eq {}} { - {return -code error [redis_read_line $fd]}
catch {close $fd} $ {return [redis_bulk_read $fd]}
set ::redis::fd($id) {} > -
return -code error "I/O error reading reply" ~ -
* {return [redis_multi_bulk_read $id $fd]}
% {return [redis_read_map $id $fd]}
| {
# ignore attributes for now (nowhere to store them)
redis_read_map $id $fd
continue
}
default {
if {$type eq {}} {
catch {close $fd}
set ::redis::fd($id) {}
return -code error "I/O error reading reply"
}
return -code error "Bad protocol, '$type' as reply type byte"
} }
return -code error "Bad protocol, '$type' as reply type byte"
} }
} }
} }
proc ::redis::redis_reset_state id { proc ::redis::redis_reset_state id {
set ::redis::state($id) [dict create buf {} mbulk -1 bulk -1 reply {}] set ::redis::state($id) [dict create buf {} mbulk -1 bulk -1 reply {}]
set ::redis::statestack($id) {} set ::redis::statestack($id) {}
} }
proc ::redis::redis_call_callback {id type reply} { proc ::redis::redis_call_callback {id type reply} {
 End of changes. 8 change blocks. 
19 lines changed or deleted 46 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)