int main(int argc, char* argv[]) { if (test_common_init(&argc, &argv) != 0) return -1; nsresult rv= (nsresult)-1; if (argc < 2) { printf("usage: %s <port>\n", argv[0]); return -1; } #if defined(PR_LOGGING) gTestLog = PR_NewLogModule("Test"); #endif /* * The following code only deals with XPCOM registration stuff. and setting * up the event queues. Copied from TestSocketIO.cpp */ rv = NS_InitXPCOM2(nullptr, nullptr, nullptr); if (NS_FAILED(rv)) return rv; { rv = MakeServer(atoi(argv[1])); if (NS_FAILED(rv)) { LOG(("MakeServer failed [rv=%x]\n", rv)); return -1; } // Enter the message pump to allow the URL load to proceed. PumpEvents(); } // this scopes the nsCOMPtrs // no nsCOMPtrs are allowed to be alive when you call NS_ShutdownXPCOM NS_ShutdownXPCOM(nullptr); return rv; }
int main() { evutil_socket_t fd = MakeServer(100); main_loop(fd); }