MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / CloseNetworking

Function CloseNetworking

networking/networking.cpp:536–571  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

534}
535
536void CloseNetworking() {
537 if (Sockets_initted != 1)
538 return;
539
540 if (NetDebugFile) {
541 cfprintf(NetDebugFile, "NetDebug.log closed at %f seconds.\n", timer_GetTime());
542 cfclose(NetDebugFile);
543 NetDebugFile = NULL;
544 }
545
546 mprintf(0, "Shutting down networking...\n");
547#ifdef WIN32
548 WSACancelBlockingCall();
549
550 dp_ShutdownDirectPlay();
551#endif
552
553 if (TCP_socket != INVALID_SOCKET) {
554 shutdown(TCP_socket, 1);
555#ifdef WIN32
556 closesocket(TCP_socket);
557#else
558 close(TCP_socket);
559#endif
560 }
561#ifdef WIN32
562 if (WSACleanup()) {
563 mprintf(0, "Error closing wsock!\n");
564 }
565#endif
566
567 Network_initted = 0;
568 Sockets_initted = 0;
569
570 NetworkProtocol = NP_NONE;
571}
572
573// Inits the sockets layer to activity
574void nw_InitNetworking(int iReadBufSizeOverride) {

Callers

nothing calls this directly

Calls 3

cfprintfFunction · 0.85
cfcloseFunction · 0.85
dp_ShutdownDirectPlayFunction · 0.85

Tested by

no test coverage detected