Changeset 8788 in ntrip


Ignore:
Timestamp:
Aug 1, 2019, 4:32:39 PM (5 years ago)
Author:
stoecker
Message:

unify code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ntripserver/ntripserver.c

    r8787 r8788  
    15871587    else if((nBufferBytes)  && (outmode == HTTP))
    15881588    {
    1589       if(remainChunk)
    1590       {
    1591         int i = send(sock, buffer, (size_t)remainChunk, MSG_DONTWAIT);
    1592         if(i < 0)
    1593         {
    1594           if(errno != EAGAIN)
    1595           {
    1596             perror("WARNING: could not send data to Destination caster");
    1597             return;
    1598           }
    1599         }
    1600         else if(i)
    1601         {
    1602           memmove(buffer, buffer+i, (size_t)(nBufferBytes-i));
    1603           nBufferBytes -= i;
    1604           remainChunk -= i;
    1605         }
    1606       }
    1607       else
    1608       {
    1609         int i, nChunkBytes;
    1610         nChunkBytes = snprintf(szSendBuffer, sizeof(szSendBuffer),"%x\r\n",
     1589      if(!remainChunk)
     1590      {
     1591        int nChunkBytes = snprintf(szSendBuffer, sizeof(szSendBuffer),"%x\r\n",
    16111592        nBufferBytes);
    16121593        send(sock, szSendBuffer, nChunkBytes, 0);
    1613         if((i = send(sock, buffer, (size_t)nBufferBytes, MSG_DONTWAIT))
    1614         != nBufferBytes)
    1615         {
    1616           if(i < 0)
    1617           {
    1618             if(errno != EAGAIN)
    1619             {
    1620               perror("WARNING: could not send data to Destination caster");
    1621               return;
    1622             }
    1623           }
    1624           else if(i)
    1625           {
    1626             memmove(buffer, buffer+i, (size_t)(nBufferBytes-i));
    1627             nBufferBytes -= i;
    1628             remainChunk = nBufferBytes;
    1629           }
    1630         }
     1594        remainChunk = nBufferBytes;
     1595      }
     1596      int i = send(sock, buffer, (size_t)remainChunk, MSG_DONTWAIT);
     1597      if(i < 0)
     1598      {
     1599        if(errno != EAGAIN)
     1600        {
     1601          perror("WARNING: could not send data to Destination caster");
     1602          return;
     1603        }
     1604      }
     1605      else if(i)
     1606      {
     1607        memmove(buffer, buffer+i, (size_t)(nBufferBytes-i));
     1608        nBufferBytes -= i;
     1609        remainChunk -= i;
    16311610      }
    16321611      if(!remainChunk)
Note: See TracChangeset for help on using the changeset viewer.