MCPcopy Create free account
hub / github.com/DaedalusX64/daedalus / WebDebug_Init

Function WebDebug_Init

Source/SysOSX/Debug/WebDebug.cpp:431–482  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

429}
430
431bool WebDebug_Init()
432{
433#if defined(DAEDALUS_W32)
434 {
435 WORD wsa_version = MAKEWORD(2, 2);
436 WSADATA wsa_data;
437 if (0 != WSAStartup( wsa_version, &wsa_data ))
438 {
439 fprintf(stderr, "WSAStartup failed\n");
440 return false;
441 }
442 }
443#endif
444
445 struct WebbyServerConfig config;
446 memset(&config, 0, sizeof config);
447 config.bind_address = "127.0.0.1";
448 config.listening_port = 8081;
449 config.flags = WEBBY_SERVER_WEBSOCKETS;
450 config.connection_max = 16; // Chrome and Firefox open lots of connections simultaneously.
451 config.request_buffer_size = 2048;
452 config.io_buffer_size = 8192;
453 config.dispatch = &WebDebugDispatch;
454 config.log = &test_log;
455 config.ws_connect = &test_ws_connect;
456 config.ws_connected = &test_ws_connected;
457 config.ws_closed = &test_ws_closed;
458 config.ws_frame = &test_ws_frame;
459
460 if (0)
461 config.flags = WEBBY_SERVER_LOG_DEBUG;
462
463 int memory_size = WebbyServerMemoryNeeded(&config);
464 gServerMemory = malloc(memory_size);
465 gServer = WebbyServerInit(&config, gServerMemory, memory_size);
466
467 if (!gServer)
468 {
469 fprintf(stderr, "failed to init server\n");
470 return false;
471 }
472
473 IO::Filename data_path;
474 IO::Path::Combine(data_path, gDaedalusExePath, "Web");
475 DBGConsole_Msg(0, "Looking for static resource in [C%s]", data_path);
476 AddStaticContent(data_path, "");
477
478 gKeepRunning = true;
479 gThread = CreateThread( "WebDebug", &WebDebugThread, gServer );
480
481 return true;
482}
483
484void WebDebug_Fini()
485{

Callers

nothing calls this directly

Calls 3

AddStaticContentFunction · 0.85
CombineFunction · 0.50
CreateThreadFunction · 0.50

Tested by

no test coverage detected