VirtualBox

Changeset 86114 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Sep 13, 2020 5:52:04 PM (4 years ago)
Author:
vboxsync
Message:

Devices/Serial/DrvTCP: Decrement connection count on orderly shutdown, fixes connection again after the remote end had disconnected, ticketref:19878

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Serial/DrvTCP.cpp

    r84688 r86114  
    136136
    137137/**
     138 * Closes the connection.
     139 *
     140 * @returns nothing.
     141 * @param   pThis                  The TCP driver instance.
     142 */
     143static void drvTcpConnectionClose(PDRVTCP pThis)
     144{
     145    Assert(pThis->hTcpSock != NIL_RTSOCKET);
     146
     147    int rc = RTPollSetRemove(pThis->hPollSet, DRVTCP_POLLSET_ID_SOCKET);
     148    AssertRC(rc);
     149
     150    if (pThis->fIsServer)
     151        RTTcpServerDisconnectClient2(pThis->hTcpSock);
     152    else
     153        RTSocketClose(pThis->hTcpSock);
     154    pThis->hTcpSock = NIL_RTSOCKET;
     155    ASMAtomicDecU32(&pThis->cConnections);
     156}
     157
     158
     159/**
    138160 * Checks the wakeup pipe for events.
    139161 *
     
    260282                    /* On error we close the socket here. */
    261283                    if (fEvtsRecv & RTPOLL_EVT_ERROR)
    262                     {
    263                         rc = RTPollSetRemove(pThis->hPollSet, DRVTCP_POLLSET_ID_SOCKET);
    264                         AssertRC(rc);
    265 
    266                         if (pThis->fIsServer)
    267                             RTTcpServerDisconnectClient2(pThis->hTcpSock);
    268                         else
    269                             RTSocketClose(pThis->hTcpSock);
    270                         pThis->hTcpSock = NIL_RTSOCKET;
    271                         ASMAtomicDecU32(&pThis->cConnections);
    272                         /* Continue with polling. */
    273                     }
     284                        drvTcpConnectionClose(pThis); /* Continue with polling afterwards. */
    274285                    else
    275286                    {
     
    328339            if (!cbRead && rc != VINF_TRY_AGAIN)
    329340            {
    330                 rc = RTPollSetRemove(pThis->hPollSet, DRVTCP_POLLSET_ID_SOCKET);
    331                 AssertRC(rc);
    332 
    333                 if (pThis->fIsServer)
    334                     RTTcpServerDisconnectClient2(pThis->hTcpSock);
    335                 else
    336                     RTSocketClose(pThis->hTcpSock);
    337                 pThis->hTcpSock = NIL_RTSOCKET;
     341                drvTcpConnectionClose(pThis);
    338342                rc = VINF_SUCCESS;
    339343            }
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette