Changeset 1399


Ignore:
Timestamp:
2008-08-15 21:43:26 (6 years ago)
Author:
drobilla
Message:

Fix 'ingen -egl'.
Never crash on an HTTP message (remove asserts, return errors instead).

Location:
ingen/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • ingen/src/libs/engine/HTTPEngineReceiver.cpp

    r1398 r1399  
    2626#include "serialisation/serialisation.hpp" 
    2727#include "serialisation/Serialiser.hpp" 
     28#include "serialisation/Loader.hpp" 
    2829#include "engine/ThreadManager.hpp" 
    2930#include "HTTPEngineReceiver.hpp" 
     
    3334 
    3435using namespace std; 
     36using namespace Ingen::Shared; 
    3537 
    3638namespace Ingen { 
     
    5153        engine.world()->serialisation_module = Ingen::Shared::load_module("ingen_serialisation"); 
    5254 
    53     if (engine.world()->serialisation_module) 
     55    if (engine.world()->serialisation_module) { 
    5456        if (!engine.world()->serialiser) 
    5557            engine.world()->serialiser = SharedPtr<Serialiser>( 
    5658                    Ingen::Serialisation::new_serialiser(engine.world())); 
    57  
    58     if (!engine.world()->serialiser) 
     59         
     60        if (!engine.world()->loader) 
     61            engine.world()->loader = SharedPtr<Loader>( 
     62                    Ingen::Serialisation::new_loader()); 
     63    } else { 
    5964        cerr << "WARNING: Failed to load ingen_serialisation module, HTTP disabled." << endl; 
     65    } 
    6066} 
    6167 
     
    96102    HTTPEngineReceiver* me = (HTTPEngineReceiver*)data; 
    97103 
    98     if (msg->method != SOUP_METHOD_GET && msg->method != SOUP_METHOD_PUT) { 
    99         soup_message_set_status (msg, SOUP_STATUS_NOT_IMPLEMENTED); 
     104    SharedPtr<Store> store = me->_engine.world()->store; 
     105    if (!store) { 
     106        soup_message_set_status (msg, SOUP_STATUS_INTERNAL_SERVER_ERROR); 
    100107        return; 
    101108    } 
    102      
    103     SharedPtr<Store> store = me->_engine.world()->store; 
    104     assert(store); 
     109 
    105110    if (!Path::is_valid(path)) { 
    106111        soup_message_set_status (msg, SOUP_STATUS_BAD_REQUEST); 
     
    127132        // Serialise object 
    128133        string base_uri = string("ingen:").append(start->second->path()); 
    129         const string response = serialiser->to_string(start->second, base_uri, 
    130                 GraphObject::Variables()); 
     134        const string response = serialiser->to_string(start->second, base_uri, GraphObject::Variables()); 
    131135        soup_message_set_status (msg, SOUP_STATUS_OK); 
    132136        soup_message_set_response (msg, "text/plain", SOUP_MEMORY_COPY, 
     
    143147        } 
    144148         
     149        // Get loader 
     150        SharedPtr<Loader> loader = me->_engine.world()->loader; 
     151        if (!loader) { 
     152            soup_message_set_status (msg, SOUP_STATUS_INTERNAL_SERVER_ERROR); 
     153            return; 
     154        } 
     155 
     156        // Load object 
     157        soup_message_set_status (msg, SOUP_STATUS_NOT_IMPLEMENTED); 
     158    } else { 
    145159        soup_message_set_status (msg, SOUP_STATUS_NOT_IMPLEMENTED); 
    146160    } 
  • ingen/src/libs/gui/Makefile.am

    r1379 r1399  
    3030 
    3131libingen_gui_la_LIBADD = \ 
     32    ../module/libingen_module.la \ 
     33    ../shared/libingen_shared.la \ 
    3234    ../client/libingen_client.la \ 
    33     ../module/libingen_module.la \ 
    3435    @CURL_LIBS@ \ 
    3536    @FLOWCANVAS_LIBS@ \ 
  • ingen/src/libs/module/World.hpp

    r1393 r1399  
    3535class Engine; 
    3636 
    37 namespace Serialisation { class Serialiser; } 
     37namespace Serialisation { class Serialiser; class Loader; } 
    3838using Serialisation::Serialiser; 
     39using Serialisation::Loader; 
    3940 
    4041namespace Shared { 
     
    6465    SharedPtr<Engine>          local_engine; 
    6566    SharedPtr<Serialiser>      serialiser; 
     67    SharedPtr<Loader>          loader; 
    6668    SharedPtr<Store>           store; 
    6769     
  • ingen/src/progs/ingen/main.cpp

    r1398 r1399  
    161161 
    162162        bool found = false; 
    163         world->serialisation_module = Ingen::Shared::load_module("ingen_serialisation"); 
     163        if (!world->serialisation_module) 
     164            world->serialisation_module = Ingen::Shared::load_module("ingen_serialisation"); 
    164165             
    165166        Serialisation::Loader* (*new_loader)() = NULL; 
Note: See TracChangeset for help on using the changeset viewer.