<html><head>
  <meta http-equiv="Content-Type" content="text/html; CHARSET=UTF-8">
  <meta name="GENERATOR" content="GtkHTML/4.2.2">
</head>
<body><div>Hi Ondrej,</div><div><br></div><div>Thanks for reporting. This bug should be fixed in GIT rev 277</div><div><br></div><div><a href="https://github.com/asples/nopoll">https://github.com/asples/nopoll</a></div><div><br></div><div>Added regression test (test_36) to reproduce the problem and</div><div>check fix introduced.</div><div><br></div><div>Best Regards,</div><div><br></div><blockquote type="cite">
Hi Ondrej,<br>
<br>
Thanks for reporting. I haven't had time to review it and let you know,<br>
<br>
I'll keep you updated about this,<br>
Best Regards,<br>
<br>
<blockquote type="CITE">
<pre>Hi,

I am using the function nopoll_thread_handlers to make the library thread safe

************************************
noPollPtr WebSocket::mutexCreate(void)
{
    std::mutex * mutex = new std::mutex;
    std::cout<<".................create"<<std::endl;
    return static_cast<noPollPtr>(mutex);
}

void WebSocket::mutexDestroy(noPollPtr _mutex)
{
    std::cout<<".................destroy"<<std::endl;
    std::mutex * mutex = static_cast<std::mutex *>(_mutex);
    delete mutex;
}

void WebSocket::mutexLock(noPollPtr _mutex)
{
    std::cout<<".................lock"<<std::endl;
    std::mutex * mutex = static_cast<std::mutex *>(_mutex);
    mutex->lock();
}

void WebSocket::mutexUnlock(noPollPtr _mutex)
{
    std::cout<<".................unlock"<<std::endl;
    std::mutex * mutex = static_cast<std::mutex *>(_mutex);
    mutex->unlock();
}

nopoll_thread_handlers(&WebSocket::mutexCreate,
&WebSocket::mutexDestroy, &WebSocket::mutexLock,
&WebSocket::mutexUnlock);

***********************************

When the socket closes (timeout on TCP socket) the library dead-locks
DEBUG PRINT:

***********************************
(proc 9668): (debug)nopoll_conn.c:3008 nopoll_conn_send_text:
Attempting to send 16 bytes

(proc 9668): (debug)nopoll_conn.c:3691 Copying into the buffer 6 bytes
of header (total memory allocated: 23)

(proc 9668): (debug)nopoll_conn.c:3705 Mask used for this delivery:
-604747364 (about to send 22 bytes)

(proc 9668): (debug)nopoll_conn.c:3743 Bytes written to the wire 22
(masked? 1, mask: 1133566964, header size: 6, length: 16)

(proc 9668): (debug)nopoll_conn.c:3781 Write operation finished with
with last result=16, bytes_written=16, requested=16, remaining=0
(conn-id=2)

.................lock

.................unlock

.................lock

.................unlock

.................lock

(proc 9668): (debug)nopoll_conn.c:2518 === START: conn-id=2 (errno=11,
session: 6, conn->handshake_ok: 1, conn->pending_ssl_accept: 0) ===

(proc 9668): (critical) nopoll_conn.c:1876 unable to readn=2, error
code was: 110 (Connection timed out) (shutting down connection)

(proc 9668): (debug)nopoll_conn.c:1436 shutting down connection id=2
(session: 6, role: client)

(proc 9668): (critical) nopoll_conn.c:2695 Received connection close,
finishing connection session

(proc 9668): (debug)nopoll_conn.c:1436 shutting down connection id=2
(session: -1, role: client)

.................unlock

.................lock

.................lock
**************************************

The problem happens because the function nopoll_ctx_foreach_conn locks
the mutex and function nopoll_ctx_unregister_conn tries to lock the
mutex again.
_______________________________________________
noPoll mailing list
<a href="mailto:noPoll@lists.aspl.es">noPoll@lists.aspl.es</a>
<a href="http://lists.aspl.es/cgi-bin/mailman/listinfo/nopoll">http://lists.aspl.es/cgi-bin/mailman/listinfo/nopoll</a>
</pre>
</blockquote>
<br>
<table cellspacing="0" cellpadding="0" width="100%">
<tbody><tr>
<td>
<pre><pre>_______________________________________________
noPoll mailing list
<a href="mailto:noPoll@lists.aspl.es">noPoll@lists.aspl.es</a>
<a href="http://lists.aspl.es/cgi-bin/mailman/listinfo/nopoll">http://lists.aspl.es/cgi-bin/mailman/listinfo/nopoll</a>
</pre></pre></td></tr></tbody></table></blockquote><div><span>-- <br><div><div>Francis Brosnan Blázquez - ASPL</div><div>91 134 14 22 - 91 134 14 45 - 91 116 07 57</div><div><br></div><div><a href="http://aspl.es">http://aspl.es</a></div><div><a href="http://asplhosting.com">http://asplhosting.com</a></div><div><a href="http://twitter.com/aspl_es">http://twitter.com/aspl_es</a></div><div><a href="http://twitter.com/asplhosting">http://twitter.com/asplhosting</a></div><div><br></div><div>AVISO LEGAL</div><div><br></div><div>Este mensaje se dirige exclusivamente a su destinatario. Los datos</div><div>incluidos en el presente correo son confidenciales y sometidos a secreto</div><div>profesional, se prohíbe divulgarlos, en virtud de las leyes vigentes. Si</div><div>usted no lo es y lo ha recibido por error o tiene conocimiento del mismo</div><div>por cualquier motivo, le rogamos que nos lo comunique por este medio y</div><div>proceda a destruirlo o borrarlo.</div><div><br></div><div>En virtud de lo dispuesto en la Ley Orgánica 15/1999, de 13 de</div><div>diciembre, de Protección de Datos de Carácter Personal, le informamos de</div><div>que sus datos de carácter personal, recogidos de fuentes accesibles al</div><div>público o datos que usted nos ha facilitado previamente, proceden de</div><div>bases de datos propiedad de Advanced Software Production Line, S.L.</div><div>(ASPL). No obstante, usted puede ejercitar sus derechos de acceso,</div><div>rectificación, cancelación y oposición dispuestos en la mencionada Ley</div><div>Orgánica, notificándolo por escrito a:</div><div>ASPL - Protección Datos, C/Antonio Suárez 10 A-102, 28802, Alcalá de</div><div>Henares (Madrid).</div><div><br></div></div></span></div></body></html>