| 534 | } |
| 535 | |
| 536 | void 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 |
| 574 | void nw_InitNetworking(int iReadBufSizeOverride) { |
nothing calls this directly
no test coverage detected