[Bro] Trouble passing a message between two local endpoints.

David Banas capn.freako at gmail.com
Mon Aug 10 06:22:21 PDT 2015


Hi all,

I’m trying to pass a message between two local endpoints, using only the C-interface in broker.h:

#include <stdio.h>
#include "broker.h"

int main (int argc, char* argv[]) {
    broker_init(0);
    broker_endpoint* ep1 = broker_endpoint_create_with_flags("ep1", 3);
    broker_endpoint* ep2 = broker_endpoint_create_with_flags("ep2", 3);
    broker_peering*    p = broker_endpoint_peer_locally(ep2, ep1);
    
    broker_string*       bs = broker_string_create("");
    broker_message_queue* q = broker_message_queue_create(bs, ep2);

    broker_string*  msg_str = broker_string_create("Hello, World!\n");
    broker_string*    topic = broker_string_create("test");
    broker_data*        msg = broker_data_from_string(msg_str);
    
    broker_vector* vec = broker_vector_create();
    int            res = broker_vector_insert(vec, msg, 0L);
                   res = broker_endpoint_send(ep1, topic, vec);
    
    broker_deque_of_message* msg_list = broker_message_queue_want_pop(q);
    size_t                   num_msgs = broker_deque_of_message_size(msg_list);
    
    printf("There are %ld messages.\n", num_msgs);
}

And I’m failing:

davids-air-2:broker-haskell dbanas$ ./a.out 
There are 0 messages.

Does anyone see what I’m doing wrong?

Thanks!
-db

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ICSI.Berkeley.EDU/pipermail/bro/attachments/20150810/1f4f3b78/attachment.html 


More information about the Bro mailing list