On Mon, Jul 24, 2017 at 6:40 AM, Charles Anthony <[email protected]> wrote: > Setting up a TCP connection: > > struct uvClientData > { > bool assoc; > uint fnpno; > uint lineno; > /* telnet_t */ void * telnetp; > // Work buffet for processLineInput > char buffer [1024]; > size_t nPos; > }; > typedef struct uvClientData uvClientData; > > linep->client = (uv_tcp_t *) malloc (sizeof (uv_tcp_t)); > uv_tcp_init (loop, linep->client); > > > uvClientData * p = (uvClientData *) malloc (sizeof (uvClientData)); > p->fnpno = fnpno; > p->lineno = lineno; > > linep->client->data = p; > > uv_tcp_connect (& linep->doConnect, linep->client, (const struct > sockaddr *) & dest, on_do_connect); > > > static void on_do_connect (uv_connect_t * server, int status) > { > uvClientData * p = (uvClientData *) server->handle->data; > struct t_line * linep = & fnpUnitData[p->fnpno].MState.line[p->lineno]; > .... > } > > I managed to invoke a connection failure, leading to an application > crash.... > > (gdb) where > #0 on_do_connect (server=0x182f7e8 <fnpUnitData+412168>, status=-125) > at fnpuv.c:755 > #1 0x00007f616eb77e1c in uv.stream_destroy () from /lib64/libuv.so.1 > #2 0x00007f616eb6e3e6 in uv_run () from /lib64/libuv.so.1 > > (gdb) p status > $10 = -125 > > 'status' shows the connection failure. > > (gdb) p server->handle->data > $9 = (void *) 0x0 > > However, it appears that the 'data' field is NULL, which means that my > callback handler has no way to find the data it needs to handle the failure. > > I am unsure if this is a bug in my code, or if stream_destroy is failing to > pass the callback the data it needs.
Libuv in general doesn't touch the .data field. Seeing that uv__stream_destroy() is in the call stack, it would seem that you called uv_close() on the handle. -- You received this message because you are subscribed to the Google Groups "libuv" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/libuv. For more options, visit https://groups.google.com/d/optout.
