示例#1
0
TSTree *add_route_data(TSTree *routes, bstring line)
{
    struct bstrList *data = bsplit(line, ' ');
    // eg. /hello && Hello

    check(data->qty == 2, "Line '%s' does not have 2 columns",
          bdata(line));


    // insert to routes, root is the first, the 2 and 3 is key anf length of key and value
    routes = TSTree_insert(routes,
                           bdata(data->entry[0]), blength(data->entry[0]),
                           bstrcpy(data->entry[1]));

    void *dl = load_dl(data->entry[1]);

    Handler *handler = Handler_create(bdata(data->entry[0]), dl);



    bstrListDestroy(data);

    return routes;

error:
    return NULL;
}
示例#2
0
char *test_Handler_create_destroy()
{
    Handler *handler = Handler_create(
            bfromcstr("tcp://127.0.0.1:12348"),
            bfromcstr("ZED"),
            bfromcstr("tcp://127.0.0.1:4321"),
            bfromcstr("ZED"));
    mu_assert(handler != NULL, "Failed to make the handler.");

    Handler_destroy(handler);

    return NULL;
}