mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
Turtle: fixed
git-svn-id: svn://ultimatepp.org/upp/trunk@11933 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
0bbb447b32
commit
dd8eaf73ae
4 changed files with 20 additions and 16 deletions
|
|
@ -516,6 +516,7 @@ bool WebSocket::WebAccept(TcpSocket& socket_, HttpHeader& hdr)
|
|||
"Sec-WebSocket-Accept: " + Base64Encode((char *)sha1, 20) + "\r\n\r\n"
|
||||
);
|
||||
|
||||
LLOG("HTTP request header received, sending response");
|
||||
data.Clear();
|
||||
opcode = READING_FRAME_HEADER;
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
namespace Upp {
|
||||
|
||||
#define LLOG(x) // LLOG(x)
|
||||
#define LDUMP(x) // RDUMP(x)
|
||||
#define LLOG(x) // DLOG(x)
|
||||
#define LDUMP(x) // DDUMP(x)
|
||||
#define LTIMING(x)
|
||||
|
||||
int Ctrl::serial_time0 = Null;
|
||||
|
|
@ -51,15 +51,17 @@ bool Ctrl::IsWaitingEvent()
|
|||
EndSession();
|
||||
Exit(0);
|
||||
}
|
||||
while(socket.Timeout(0).WaitRead()) {
|
||||
socket.Timeout(20000);
|
||||
websocket.Do();
|
||||
for(;;) {
|
||||
String s = websocket.Receive();
|
||||
if(s.IsVoid()) { // No data returned -> means EOF was reached
|
||||
if(websocket.IsClosed()) {
|
||||
WhenDisconnect();
|
||||
EndSession();
|
||||
Exit(0);
|
||||
}
|
||||
LLOG("Recieved data " << s);
|
||||
if(s.GetCount() == 0)
|
||||
break;
|
||||
LLOG("Received data " << s);
|
||||
StringStream ss(s);
|
||||
while(!ss.IsEof()) {
|
||||
String s = ss.GetLine();
|
||||
|
|
@ -82,7 +84,6 @@ bool Ctrl::IsWaitingEvent()
|
|||
serial_time0 = Null;
|
||||
}
|
||||
}
|
||||
socket.Timeout(20000);
|
||||
if(socket.IsError())
|
||||
LLOG("ERROR: " << socket.GetErrorDesc());
|
||||
return event_queue.GetCount();
|
||||
|
|
@ -92,10 +93,11 @@ void Ctrl::GuiSleep(int ms)
|
|||
{
|
||||
GuiLock __;
|
||||
ASSERT(IsMainThread());
|
||||
// LLOG("GuiSleep");
|
||||
LLOG("GuiSleep " << ms);
|
||||
websocket.Do();
|
||||
int level = LeaveGuiMutexAll();
|
||||
socket.Timeout(ms).WaitRead();
|
||||
socket.Timeout(20000);
|
||||
socket.Timeout(0);
|
||||
EnterGuiMutex(level);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,6 @@ void Turtle_PutLink(const String& link)
|
|||
|
||||
void Ctrl::Output()
|
||||
{
|
||||
socket.Timeout(20000);
|
||||
if(turtle_stream.HasData()) {
|
||||
websocket.SendBinary(ZCompress(String(DISABLESENDING, 1))); // Do not send events until data transfered and processed
|
||||
int64 x = ++update_serial;
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
|
||||
namespace Upp {
|
||||
|
||||
#define LLOG(x) // DLOG(x)
|
||||
#define LDUMP(x) // DDUMP(x)
|
||||
#define LLOG(x) // DLOG(x)
|
||||
#define LDUMP(x) // DDUMP(x)
|
||||
#define LTIMING(x)
|
||||
|
||||
int Ctrl::main_pid;
|
||||
|
|
@ -71,7 +71,7 @@ bool Ctrl::StartSession()
|
|||
#endif
|
||||
|
||||
LLOG("Starting to listen on " << port << ", pid: " << getpid());
|
||||
socket.Timeout(2000); // TODO: Not quite ideal way to make quit work..
|
||||
socket.Timeout(0); // TODO: Not quite ideal way to make quit work..
|
||||
for(;;) {
|
||||
if(quit)
|
||||
return false;
|
||||
|
|
@ -108,7 +108,7 @@ bool Ctrl::StartSession()
|
|||
socket.Close();
|
||||
continue;
|
||||
}
|
||||
#else
|
||||
#else
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
|
@ -128,9 +128,7 @@ bool Ctrl::StartSession()
|
|||
Ctrl::GlobalBackBuffer();
|
||||
Ctrl::InitTimer();
|
||||
|
||||
#ifdef PLATFORM_POSIX
|
||||
SetStdFont(ScreenSans(12)); //FIXME general handling
|
||||
#endif
|
||||
ChStdSkin();
|
||||
|
||||
DesktopRect().Color(Cyan());
|
||||
|
|
@ -138,10 +136,14 @@ bool Ctrl::StartSession()
|
|||
SetDesktop(Desktop());
|
||||
|
||||
stat_started = GetSysTime();
|
||||
|
||||
LLOG("Waiting for the event");
|
||||
|
||||
while(!IsWaitingEvent())
|
||||
GuiSleep(10);
|
||||
|
||||
LLOG("Starting the server");
|
||||
|
||||
ProcessEvents();
|
||||
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue