Hi, As suggested, I tired printing logs before and after recv ( ) inside 
ns_server_wakeup_ex( ) and ns_server_poll( ).
Observation is that, in ns_server_poll ( ) there are prints getting printed 
before and after recv ( ).
However, in ns_server_wakeup_ex( ) the same doesnt happen. Before and After 
recv ( ) gets printed untill the case of getting blocked inside recv ( ) 
occurs.
Hence Polling stops and the message exchange over mg_conn stops.

In my code, currently if i comment recv ( ) inside ns_server_wakeup_ex( ), 
everything is working fine.
I have a question here, what is the significance of having recv ( ) inside 
ns_server_wakeup_ex( ) ? Because, ns_server_wakeup_ex( ) is called 
from mg_wakeup_server_ex ( ), and i call mg_wakeup_server_ex ( ) with a 
callback where i write into websocket using mg_websocket_write( ). So If my 
job is just to write/ send to websocket , why reading / recv ( ) in 
 ns_server_wakeup_ex( ) ? 

Below is my code,
static int websocket_data_push(struct mg_connection *conn, enum mg_event ev)
{
   printf("Inside websocket_data_push \n");
   printf("URI  %s \n" ,conn->uri);
   printf("Sending Event  %s \n" ,(char *) conn->callback_param);
    if (ev == MG_POLL)
    {
        if (strcmp(conn->uri, "/web") == 0 && conn->is_websocket) {
            printf("Sending Event  %s \n" ,(char *) conn->callback_param);
            mg_websocket_printf(conn, WEBSOCKET_OPCODE_TEXT, "%s",
                                (const char *) conn->callback_param);
        }
    }
    return MG_TRUE;
}

...
mg_wakeup_server_ex(mgserver, websocket_data_push, "%lu %s",
                            (unsigned long) time(NULL), (const char *) 
evString);
...

Do you suspect, if return value of callback would matter ? 
If yes, then my other cases would not be working fine.

Basically, My code is a mixture of C & C++.
I have mg_wakeup_server_ex( ) called from a member function of Class-A and 
callback is a global function to this class. 
I have Class-B Class-C and Class-D, doing the job and ultimately framing a 
char* response to be sent to client.
So these classes call the method, where mg_wakeup_server_ex ( ) is invoked.
Things work fine Class-B and Class-C. But Class-D which does exactly the 
same job, its response gets blocked in recv ( ) . As I said earlier , 
commenting recv ( ) works fine for everything that I expect.

Could you suggest something ? 

-- 
You received this message because you are subscribed to the Google Groups 
"mongoose-users" 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 http://groups.google.com/group/mongoose-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to