Changeset 932 in vbox
- Timestamp:
- Feb 15, 2007 6:25:10 PM (18 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/tcp.h
r204 r932 116 116 117 117 /** 118 * Terminate the open connection to the server. 119 * 120 * @returns iprt status code. 121 * @param pServer Handle to the server. 122 */ 123 RTR3DECL(int) RTTcpServerDisconnectClient(PRTTCPSERVER pServer); 124 125 /** 118 126 * Connect (as a client) to a TCP Server. 119 127 * -
trunk/src/VBox/Runtime/r3/tcp.cpp
r1 r932 434 434 435 435 436 /** 437 * Closes the client socket. 438 */ 439 static int rtTcpServerDestroyClientSock(RTSOCKET volatile *pSock, const char *pszMsg) 440 { 441 RTSOCKET Sock = rtTcpAtomicXchgSock(pSock, NIL_RTSOCKET); 442 if (Sock != NIL_RTSOCKET) 443 { 444 shutdown(Sock, SHUT_RDWR); 445 } 446 return rtTcpClose(Sock, pszMsg); 447 } 448 436 449 437 450 /** … … 479 492 rtTcpAtomicXchgSock(&pServer->SockClient, Socket); 480 493 rc = pServer->pfnServe(Socket, pServer->pvUser); 481 rtTcp Close(rtTcpAtomicXchgSock(&pServer->SockClient, NIL_RTSOCKET), "Listener: client");494 rtTcpServerDestroyClientSock(&pServer->SockClient, "Listener: client"); 482 495 483 496 /* … … 554 567 555 568 /** 569 * Terminate the open connection to the server. 570 * 571 * @returns iprt status code. 572 * @param pServer Handle to the server. 573 */ 574 RTR3DECL(int) RTTcpServerDisconnectClient(PRTTCPSERVER pServer) 575 { 576 /* 577 * Validate input. 578 */ 579 if ( !pServer 580 || pServer->enmState <= RTTCPSERVERSTATE_INVALID 581 || pServer->enmState >= RTTCPSERVERSTATE_FREED) 582 { 583 AssertMsgFailed(("Invalid parameter!\n")); 584 return VERR_INVALID_PARAMETER; 585 } 586 587 return rtTcpServerDestroyClientSock(&pServer->SockClient, "DisconnectClient: client"); 588 } 589 590 591 /** 556 592 * Closes down and frees a TCP Server. 557 593 * This will also terminate any open connections to the server. … … 594 630 { 595 631 /* client */ 596 RTSOCKET SockClient = rtTcpAtomicXchgSock(&pServer->SockClient, NIL_RTSOCKET); 597 if (SockClient != NIL_RTSOCKET) 598 { 599 shutdown(SockClient, SHUT_RDWR); 600 rtTcpClose(SockClient, "Destroyer: client"); 601 } 632 rtTcpServerDestroyClientSock(&pServer->SockClient, "Destroyer: client"); 633 602 634 bool fRc = rtTcpServerSetState(pServer, RTTCPSERVERSTATE_DESTROYING, RTTCPSERVERSTATE_SIGNALING); 603 635 Assert(fRc); NOREF(fRc);
Note:
See TracChangeset
for help on using the changeset viewer.