Changeset 6011 for trunk/gui/scripts
- Timestamp:
- Feb 14, 2016, 2:42:06 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/visviewer.tcl
r5725 r6011 75 75 private method SendDebugCommand {} 76 76 private method SendHelper {} 77 private method SendHelper.old {}78 77 private method ServerDown {} 79 78 private method Shuffle { servers } … … 334 333 set _sid "" 335 334 set _buffer(in) "" 335 set _buffer(out) "" 336 336 set _outbuf "" 337 337 set _cmdSeq 0 … … 421 421 422 422 # 423 # SendHelper.old --424 #425 # Helper routine called from a file event to send data when the426 # connection is writable (i.e. not blocked). Sends data in chunks of 8k427 # (or less). Sets magic variable _done($this) to indicate that we're428 # either finished (success) or could not send bytes to the server429 # (failure).430 #431 itcl::body Rappture::VisViewer::SendHelper.old {} {432 if { ![CheckConnection] } {433 return 0434 }435 set bytesLeft [string length $_buffer(out)]436 if { $bytesLeft > 0} {437 set chunk [string range $_buffer(out) 0 8095]438 set _buffer(out) [string range $_buffer(out) 8096 end]439 incr bytesLeft -8096440 set code [catch {441 if { $bytesLeft > 0 } {442 puts -nonewline $_sid $chunk443 } else {444 puts $_sid $chunk445 }446 } err]447 if { $code != 0 } {448 puts stderr "error sending data to $_sid: $err"449 Disconnect450 set _done($this) 0; # Failure451 }452 } else {453 set _done($this) 1; # Success454 }455 }456 457 #458 423 # SendBytes -- 459 424 # … … 470 435 # before sending anything. 471 436 set _done($this) 1 472 if { $_buffer(out) != ""} {473 puts stderr " ERROR: re-entered SendBytes: buffer=([string range $_buffer(out) 0 70]...)"474 puts stderr "New cmd $_cmdSeq: [string range $bytes 0 70]..."475 }476 set_buffer(out) $bytes437 if { $_debug && [string bytelength $_buffer(out)] > 0 } { 438 puts stderr "SendBytes: appending to output buffer" 439 } 440 # Append to the buffer, since we may have been called recursively 441 append _buffer(out) $bytes 477 442 # There's problem when the user is interacting with the GUI at the 478 443 # same time we're trying to write to the server. Don't want to … … 481 446 # mouse movements aren't received. 482 447 if {$_blockOnWrite} { 483 # Let's try this approach: allow a write to block so we don't 484 # re-enter SendBytes 448 # Allow a write to block. In this case we won't re-enter SendBytes. 485 449 SendHelper 486 450 } else { 487 # This can cause us to re-enter SendBytes during the tkwait, which488 # is not safe because the _buffer will be clobbered451 # NOTE: This can cause us to re-enter SendBytes during the tkwait. 452 # For this reason, we append to the buffer in the code above. 489 453 if { [info exists itk_component(main)] } { 490 454 blt::busy hold $itk_component(main) -cursor ""
Note: See TracChangeset
for help on using the changeset viewer.