- Timestamp:
- Mar 20, 2016 2:47:36 AM (8 years ago)
- Location:
- branches/1.5
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.5
-
branches/1.5/gui/scripts/visviewer.tcl
r6127 r6156 74 74 private method SendDebugCommand {} 75 75 private method SendHelper {} 76 private method SendHelper.old {}77 76 private method ServerDown {} 78 77 private method Shuffle { servers } … … 332 331 set _sid "" 333 332 set _buffer(in) "" 333 set _buffer(out) "" 334 334 set _outbuf "" 335 335 set _cmdSeq 0 … … 419 419 420 420 # 421 # SendHelper.old --422 #423 # Helper routine called from a file event to send data when the424 # connection is writable (i.e. not blocked). Sends data in chunks of 8k425 # (or less). Sets magic variable _done($this) to indicate that we're426 # either finished (success) or could not send bytes to the server427 # (failure).428 #429 itcl::body Rappture::VisViewer::SendHelper.old {} {430 if { ![CheckConnection] } {431 return 0432 }433 set bytesLeft [string length $_buffer(out)]434 if { $bytesLeft > 0} {435 set chunk [string range $_buffer(out) 0 8095]436 set _buffer(out) [string range $_buffer(out) 8096 end]437 incr bytesLeft -8096438 set code [catch {439 if { $bytesLeft > 0 } {440 puts -nonewline $_sid $chunk441 } else {442 puts $_sid $chunk443 }444 } err]445 if { $code != 0 } {446 puts stderr "error sending data to $_sid: $err"447 Disconnect448 set _done($this) 0; # Failure449 }450 } else {451 set _done($this) 1; # Success452 }453 }454 455 #456 421 # SendBytes -- 457 422 # … … 468 433 # before sending anything. 469 434 set _done($this) 1 470 if { $_trace && $_buffer(out) != ""} {471 puts stderr " ERROR: re-entered SendBytes: buffer=([string range $_buffer(out) 0 70]...)"472 puts stderr "New cmd $_cmdSeq: [string range $bytes 0 70]..."473 }474 set_buffer(out) $bytes435 if { $_debug && [string bytelength $_buffer(out)] > 0 } { 436 puts stderr "SendBytes: appending to output buffer" 437 } 438 # Append to the buffer, since we may have been called recursively 439 append _buffer(out) $bytes 475 440 # There's problem when the user is interacting with the GUI at the 476 441 # same time we're trying to write to the server. Don't want to … … 479 444 # mouse movements aren't received. 480 445 if {$_blockOnWrite} { 481 # Let's try this approach: allow a write to block so we don't 482 # re-enter SendBytes 446 # Allow a write to block. In this case we won't re-enter SendBytes. 483 447 SendHelper 484 448 } else { 485 # This can cause us to re-enter SendBytes during the tkwait, which486 # is not safe because the _buffer will be clobbered449 # NOTE: This can cause us to re-enter SendBytes during the tkwait. 450 # For this reason, we append to the buffer in the code above. 487 451 if { [info exists itk_component(main)] } { 488 452 blt::busy hold $itk_component(main) -cursor ""
Note: See TracChangeset
for help on using the changeset viewer.