Index: openacs-4/packages/xotcl-core/tcl/bgdelivery-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-core/tcl/bgdelivery-procs.tcl,v diff -u -N -r1.53 -r1.54 --- openacs-4/packages/xotcl-core/tcl/bgdelivery-procs.tcl 7 Oct 2017 18:26:54 -0000 1.53 +++ openacs-4/packages/xotcl-core/tcl/bgdelivery-procs.tcl 21 Oct 2017 13:07:27 -0000 1.54 @@ -103,7 +103,7 @@ ns_log notice "no Range spool for $filename" fcopy $fd $channel -command [list [self] end-delivery -client_data $client_data $filename $fd $channel] } else { - my deliver_ranges $ranges $client_data $filename $fd $channel + :deliver_ranges $ranges $client_data $filename $fd $channel } #ns_log notice "--- start of delivery of $filename (running:[array size ::running])" set key $channel,$fd,$filename @@ -141,7 +141,7 @@ } fileSpooler proc tick {} { if {[catch {my cleanup} errorMsg]} {ns_log error "Error during filespooler cleanup: $errorMsg"} - my set to [after [my set tick_interval] [list [self] tick]] + set :to [after ${:tick_interval} [list [self] tick]] } fileSpooler tick @@ -234,51 +234,49 @@ {verbose false} } ::AsyncDiskWriter instproc log {msg} { - if {[my verbose]} {ns_log notice "[self] --- $msg"} + if {[:verbose]} {ns_log notice "[self] --- $msg"} } ::AsyncDiskWriter instproc open {-filename {-mode w}} { - my set channel [open $filename $mode] - my set content "" - my set filename $filename - fconfigure [my set channel] -translation binary -blocking false - my log "open [my set filename]" + set :channel [open $filename $mode] + set :content "" + set :filename $filename + fconfigure ${:channel} -translation binary -blocking false + :log "open ${:filename}" } ::AsyncDiskWriter instproc close {{-sync false}} { - my instvar content channel - if {$sync || $content eq ""} { - my log "close sync" - if {$content ne ""} { - fconfigure $channel -translation binary -blocking true - puts -nonewline $channel $content + if {$sync || ${:content} eq ""} { + :log "close sync" + if {${:content} ne ""} { + fconfigure ${:channel} -translation binary -blocking true + puts -nonewline ${:channel} ${:content} } - close $channel - my destroy + close ${:channel} + :destroy } else { - my log "close async" - my set finishWhenDone 1 + :log "close async" + set :finishWhenDone 1 } } ::AsyncDiskWriter instproc async_write {block} { - my append content $block - fileevent [my set channel] writable [list [self] writeBlock] + append :content $block + fileevent ${:channel} writable [list [self] writeBlock] } ::AsyncDiskWriter instproc writeBlock {} { - my instvar content blocksize channel - if {[string length $content] < $blocksize} { - puts -nonewline $channel $content - my log "write [string length $content] bytes" - fileevent [my set channel] writable "" - set content "" - if {[my autoflush]} {flush $channel} - if {[my exists finishWhenDone]} { - my close -sync true + if {[string length ${:content}] < ${:blocksize}} { + puts -nonewline ${:channel} ${:content} + :log "write [string length ${:content}] bytes" + fileevent ${:channel} writable "" + set :content "" + if {[:autoflush]} {flush ${:channel}} + if {[info exists :finishWhenDone]} { + :close -sync true } } else { - set chunk [string range $content 0 $blocksize-1] - set content [string range $content $blocksize end] - puts -nonewline $channel $chunk - my log "write [string length $chunk] bytes ([string length $content] buffered)" + set chunk [string range ${:content} 0 ${:blocksize}-1] + set :content [string range ${:content} ${:blocksize} end] + puts -nonewline ${:channel} $chunk + :log "write [string length $chunk] bytes ([string length ${:content}] buffered)" } } @@ -291,21 +289,20 @@ ::xotcl::Class create Subscriber -parameter {key channel user_id mode} Subscriber proc current {-key } { - my instvar subscriptions set result [list] if {[info exists key]} { - if {[info exists subscriptions($key)]} { - return [list $key $subscriptions($key)] + if {[info exists :subscriptions($key)]} { + return [list $key [set :subscriptions($key)]] } - } elseif {[info exists subscriptions]} { - foreach key [array names subscriptions] { - lappend result $key $subscriptions($key) + } elseif {[info exists :subscriptions]} { + foreach key [array names :subscriptions] { + lappend result $key [set :subscriptions($key)] } } } Subscriber instproc close {} { - set channel [my channel] + set channel [:channel] # # It is important to make the channel non-blocking for the close, # since otherwise the close operation might block and bring all of @@ -321,9 +318,9 @@ # destroys the instance. In this step the peer connection is close # as well. # - set channel [my channel] + set channel [:channel] if {[catch {set eof [eof $channel]}]} {set eof 1} - my log "sweep [my channel] EOF $eof" + :log "sweep [:channel] EOF $eof" if {$eof} { error "connection $channel closed by peer" } @@ -339,9 +336,9 @@ } Subscriber instproc send {msg} { - #ns_log notice "SEND <$msg> [my mode]" - my log "" - if {[my mode] eq "scripted"} { + #ns_log notice "SEND <$msg> [:mode]" + :log "" + if {[:mode] eq "scripted"} { set emsg [encoding convertto utf-8 $msg] #ns_log notice "SEND data <$msg> encoded <$emsg>" set smsg "