mirror of
https://github.com/deavmi/nostril
synced 2024-09-20 01:43:26 +02:00
Server
- Undid the check for data, I don't believe the `receiveTExt()` blocks forever?, We will Have to see
This commit is contained in:
parent
617a4507cc
commit
f7ec2321b6
@ -172,38 +172,33 @@ public class Connection : Fiber
|
|||||||
*/
|
*/
|
||||||
while(socket.connected() && !hadError)
|
while(socket.connected() && !hadError)
|
||||||
{
|
{
|
||||||
/**
|
/* The received data */
|
||||||
* Check if there is data received and then process it
|
string data;
|
||||||
*/
|
|
||||||
if(socket.dataAvailableForRead())
|
try
|
||||||
{
|
{
|
||||||
/* The received data */
|
// TODO: We could juist cal, this (I presume - I must check)
|
||||||
string data;
|
// ... that this is async I/O fiber vibe (then no need for yield() at end)
|
||||||
|
data = socket.receiveText();
|
||||||
try
|
|
||||||
{
|
|
||||||
// TODO: We could juist cal, this (I presume - I must check)
|
|
||||||
// ... that this is async I/O fiber vibe (then no need for yield() at end)
|
|
||||||
data = socket.receiveText();
|
|
||||||
}
|
|
||||||
/* On connection error or format error */
|
|
||||||
catch(WebSocketException e)
|
|
||||||
{
|
|
||||||
logger.error("Error in receive text");
|
|
||||||
hadError = true;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
handler(data);
|
|
||||||
}
|
|
||||||
catch(Exception e)
|
|
||||||
{
|
|
||||||
logger.error("Error in handler");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
/* On connection error or format error */
|
||||||
|
catch(WebSocketException e)
|
||||||
|
{
|
||||||
|
logger.error("Error in receive text");
|
||||||
|
hadError = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
handler(data);
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
logger.error("Error in handler");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user