[Libwebsockets] new context_info structs

Jack Mitchell ml at communistcode.co.uk
Mon Feb 11 16:09:26 CET 2013


Hi,

I am having issues trying to create my contexts properly (I think) with 
the new struct layout.

I have the following:

static struct libwebsocket_protocols generic_protocol[] =
{
    {"http-only", callback_http, 0, 0},
    {"send-receive-value", webSock_genericSendRecieve, sizeof(struct 
per_session_data_genericSendRecieve), RX_BUFFER_SIZE},
    {NULL, NULL, 0, 0},
};

card {
       .context_info =
       {
          .port = PORT_BASE_ADDRESS,
          .protocols = generic_protocol,
          .extensions = libwebsocket_internal_extensions,
          .gid = -1,
          .uid = -1,
       },
}

libwebsocket_create_context(&card->context_info);

However, when I run my application I get a segfault, under GDB it points 
to this:

[946686144:9408] NOTICE: Initial logging level 7
[946686144:9426] NOTICE: Library version: 1.1 224149a
[946686144:9445] NOTICE:  static allocation: 5460 + (12 x 1024 fds) = 
17748 bytes
[946686144:9500] NOTICE:  canonical_hostname = xx
[946686144:9524] NOTICE:  Compiled without SSL support
[946686144:9543] NOTICE:  per-conn mem: 172 + 1328 headers + protocol rx buf
[946686144:9557] NOTICE:  Listening on port 8000


Program received signal SIGSEGV, Segmentation fault.
libwebsocket_callback_on_writable_all_protocol 
(protocol=protocol at entry=0x1d370 <systemConf+96>)
     at libwebsockets.c:1342
1342        for (n = 0; n < context->fds_count; n++) {

It looks like I am initialising something wrong but I'm not sure what...

Does this set off any alarm bells. Am I initialising everything fully in 
the .context_info struct, do I need to put all the SSL related 
parameters and such in there?

Regards,
Jack.

-- 

   Jack Mitchell (jack at embed.me.uk)
   Embedded Systems Engineer
   http://www.embed.me.uk

--




More information about the Libwebsockets mailing list