Changeset 3451 for trunk/packages


Ignore:
Timestamp:
Mar 4, 2013, 8:10:40 PM (12 years ago)
Author:
ldelgass
Message:

Add ok (acknowlege commands with no render required) response.

Location:
trunk/packages/vizservers/vtkvis
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/vizservers/vtkvis/ResponseQueue.h

    r3330 r3451  
    3232        LEGEND,         /**< Legend to be displayed. */
    3333        DATA,           /**< Any other type of non-error message. */
    34         ERROR           /**< Error message. */
     34        ERROR,          /**< Error message. */
     35        OK              /**< Ack for client when no render required */
    3536    };
    3637
  • trunk/packages/vizservers/vtkvis/RpVtkRenderServer.cpp

    r3403 r3451  
    196196#endif /*USE_THREADS*/
    197197
    198 #ifndef STATSDIR
    199 #define STATSDIR        "/var/tmp/visservers"
    200 #endif  /*STATSDIR*/
     198static int sendAck(ClientData clientData, int fdOut)
     199{
     200    std::ostringstream oss;
     201    oss << "nv>ok -token " << g_stats.nCommands <<  "\n";
     202    int nBytes = oss.str().length();
     203
     204    TRACE("Sending OK for commands through %lu", g_stats.nCommands);
     205#ifdef USE_THREADS
     206    queueResponse(clientData, oss.str().c_str(), nBytes, Response::VOLATILE, Response::OK);
     207#else
     208    if (write(fdOut, oss.str().c_str(), nBytes) < 0) {
     209        ERROR("write failed: %s", strerror(errno));
     210        return -1;
     211    }
     212#endif
     213    return 0;
     214}
    201215
    202216int
     
    455469        } else {
    456470            TRACE("No render required");
     471            sendAck((ClientData)clientData, g_fdOut);
    457472        }
    458473
  • trunk/packages/vizservers/vtkvis/RpVtkRenderServer.h

    r3410 r3451  
    2525#ifndef STATSDIR
    2626#define STATSDIR        "/var/tmp/visservers"
    27 #endif 
     27#endif
    2828
    2929typedef struct {
  • trunk/packages/vizservers/vtkvis/RpVtkRenderer.cpp

    r3419 r3451  
    43364336 * \brief Get nearest data value given display coordinates x,y
    43374337 *
     4338 * FIXME: This doesn't work when actors are scaled
     4339 *
    43384340 * Note: no interpolation is performed on data
    43394341 */
  • trunk/packages/vizservers/vtkvis/RpVtkRendererCmd.cpp

    r3423 r3451  
    3737
    3838#ifdef USE_THREADS
    39 static void
    40 QueueResponse(ClientData clientData, const void *bytes, size_t len,
    41               Response::AllocationType allocType,
    42               Response::ResponseType type = Response::DATA)
     39void
     40Rappture::VtkVis::queueResponse(ClientData clientData,
     41                                const void *bytes, size_t len,
     42                                Response::AllocationType allocType,
     43                                Response::ResponseType type)
    4344{
    4445    ResponseQueue *queue = (ResponseQueue *)clientData;
     
    19351936
    19361937#ifdef USE_THREADS
    1937     QueueResponse(clientData, buf, strlen(buf), Response::VOLATILE);
     1938    queueResponse(clientData, buf, strlen(buf), Response::VOLATILE);
    19381939#else
    19391940    ssize_t bytesWritten = SocketWrite(buf, strlen(buf));
     
    41624163
    41634164#ifdef USE_THREADS
    4164     QueueResponse(clientData, buf, length, Response::VOLATILE);
     4165    queueResponse(clientData, buf, length, Response::VOLATILE);
    41654166#else
    41664167    ssize_t bytesWritten = SocketWrite(buf, length);
     
    41984199
    41994200#ifdef USE_THREADS
    4200     QueueResponse(clientData, buf, length, Response::VOLATILE);
     4201    queueResponse(clientData, buf, length, Response::VOLATILE);
    42014202#else
    42024203    ssize_t bytesWritten = SocketWrite(buf, length);
     
    42524253
    42534254#ifdef USE_THREADS
    4254     QueueResponse(clientData, buf, length, Response::VOLATILE);
     4255    queueResponse(clientData, buf, length, Response::VOLATILE);
    42554256#else
    42564257    ssize_t bytesWritten = SocketWrite(buf, length);
     
    42874288                      value[0], value[1], value[2], name);
    42884289#ifdef USE_THREADS
    4289     QueueResponse(clientData, buf, length, Response::VOLATILE);
     4290    queueResponse(clientData, buf, length, Response::VOLATILE);
    42904291#else
    42914292    ssize_t bytesWritten = SocketWrite(buf, length);
     
    43984399    len += 2;
    43994400#ifdef USE_THREADS
    4400     QueueResponse(clientData, oss.str().c_str(), len, Response::VOLATILE);
     4401    queueResponse(clientData, oss.str().c_str(), len, Response::VOLATILE);
    44014402#else
    44024403    ssize_t bytesWritten = SocketWrite(oss.str().c_str(), len);
     
    97899790
    97909791#ifdef USE_THREADS
    9791             QueueResponse(clientData, oss.str().c_str(), nBytes, Response::VOLATILE, Response::ERROR);
     9792            queueResponse(clientData, oss.str().c_str(), nBytes, Response::VOLATILE, Response::ERROR);
    97929793#else
    97939794            if (write(fdOut, oss.str().c_str(), nBytes) < 0) {
     
    98149815
    98159816#ifdef USE_THREADS
    9816         QueueResponse(clientData, oss.str().c_str(), nBytes, Response::VOLATILE, Response::ERROR);
     9817        queueResponse(clientData, oss.str().c_str(), nBytes, Response::VOLATILE, Response::ERROR);
    98179818#else
    98189819        if (write(fdOut, oss.str().c_str(), nBytes) < 0) {
  • trunk/packages/vizservers/vtkvis/RpVtkRendererCmd.h

    r3360 r3451  
    1313
    1414#include "ReadBuffer.h"
     15#ifdef USE_THREADS
     16#include "ResponseQueue.h"
     17#endif
    1518
    1619namespace Rappture {
    1720namespace VtkVis {
     21
     22#ifdef USE_THREADS
     23extern void queueResponse(ClientData clientData, const void *bytes, size_t len,
     24                          Response::AllocationType allocType,
     25                          Response::ResponseType type = Response::DATA);
     26#endif
    1827
    1928extern int processCommands(Tcl_Interp *interp,
Note: See TracChangeset for help on using the changeset viewer.