trafficserver-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Heitor Ganzeli <hei...@nic.br>
Subject ATS Net connection
Date Thu, 14 Mar 2013 19:02:25 GMT
Hi all,

For a couple of weeks, I've been trying to develop a plugin capable of
doing some specific requests to other server. And, I'm still stuck. So
I'd like if anyone could help me with this plugin or give some guidance
on where to look for the answer.

the problem is as follow:

I'm on a Ubuntu 12.04 machine using traffic server 3.2.x from the git
repository and I'm trying to do something similar to the protocol plugin
which is included in the examples folder.
By now, could rightly start a connection via TSNetConnet and receive its
call back event, TS_EVENT_NET_CONNECT. However, when i try to write
something to the TSVConn objetc, via TSVConnWrite, it crashes.

the code is as follows:
    TxnSM *txn_sm = (TxnSM *) TSContDataGet(contp);
    struct sockaddr const* q_server_addr;
    struct sockaddr_in ip_addr;

    /* Get the server IP from data structure TSHostLookupResult. */
    q_server_addr = TSHostLookupResultAddrGet(host_info);

    memcpy(&ip_addr, q_server_addr, sizeof(ip_addr));
    ip_addr.sin_port = 80;
   
    txn_sm->q_pending_action = TSNetConnect(contp,
            (struct sockaddr const*) &ip_addr);
and, although port is set to 80, the request is made to the port 20480.
then, when it receives the TS_EVENT_NET_CONNECT event, the code is as
follows:

    TxnSM *txn_sm = (TxnSM *) TSContDataGet(contp);
    txn_sm->q_pending_action = NULL;
    txn_sm->q_server_vc = vc;

    TSIOBuffer bufp = TSIOBufferCreate();
    TSIOBufferReader bufp_reader = TSIOBufferReaderAlloc(bufp);

    TSIOBufferWrite(bufp, "test", strlen("test"));

    txn_sm->q_server_write_vio = TSVConnWrite(txn_sm->q_server_vc, contp,
            bufp_reader, strlen("teste"));

After this execution, the Continuation contp do not receive events call
back anymore.
The stack trace is below, but I con't think it is much of help:
/usr/local/bin/traffic_server(_ZN6HttpSM16do_hostdb_lookupEv+0xaa)[0x5271ea]
/usr/local/bin/traffic_server(_ZN6HttpSM14set_next_stateEv+0x10b7)[0x538677]
/home/heitor/workspace/trafficserver/plugins/ptt-cache/ptt-cache.so(prepare_to_die+0x39)[0x2afb00206a99]
/usr/local/bin/traffic_server(_Z15write_to_net_ioP10NetHandlerP18UnixNetVConnectionP7EThread+0x12bc)[0x686f6c]
/usr/local/bin/traffic_server(_ZN10NetHandler12mainNetEventEiP5Event+0x293)[0x67d663]
/lib/x86_64-linux-gnu/libpthread.so.0(+0xfcb0)[0x2afae325fcb0]
/usr/local/bin/traffic_server(_ZN7EThread13process_eventEP5Eventi+0x90)[0x6ab570]
/usr/local/bin/traffic_server(_ZN15HostDBProcessor13getbyname_immEP12ContinuationMS0_FvP10HostDBInfoEPKciiii+0x8d)[0x5e217d]
/usr/local/bin/traffic_server(_ZN7EThread7executeEv+0x52c)[0x6ac06c]
/usr/local/bin/traffic_server(_ZN6HttpSM16do_hostdb_lookupEv+0xaa)[0x5271ea]
/usr/local/bin/traffic_server[0x6aa352]
/usr/local/bin/traffic_server(_ZN6HttpSM14set_next_stateEv+0x10b7)[0x538677]
/home/heitor/workspace/trafficserver/plugins/ptt-cache/ptt-cache.so(prepare_to_die+0x39)[0x2afb00206a99]
/usr/local/bin/traffic_server(_Z15write_to_net_ioP10NetHandlerP18UnixNetVConnectionP7EThread+0x12bc)[0x686f6c]
/usr/local/bin/traffic_server(_ZN10NetHandler12mainNetEventEiP5Event+0x293)[0x67d663]
/usr/local/bin/traffic_server(_ZN7EThread13process_eventEP5Eventi+0x90)[0x6ab570]
/usr/local/bin/traffic_server(_ZN7EThread7executeEv+0x52c)[0x6ac06c]
/usr/local/bin/traffic_server[0x6aa352]

Furthermore, I've already tried some alternatives like the TSHttpConnect
but the result was simmilar

thanks in advance,

Regards,
Heitor Ganzeli





Mime
View raw message