Changeset 1172


Ignore:
Timestamp:
Feb 4, 2004, 11:36:47 PM (22 years ago)
Author:
bird
Message:

Fixed bug.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/emx/src/libsocket/bsdselect.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r1171 r1172  
    7171#ifdef TCPV40HDRS
    7272    /* here we need to figure out the max real socket handle */
    73     int iMax = *pcFDs - 1;
    74     for (iMax = 0, i = 0; i < c; i++)
     73    int iMax;
     74    for (iMax = *pcFDs - 1, i = 0; i < c; i++)
    7575        if (FD_ISSET(i, pFrom))
    7676        {
     
    101101 * @param   pTo     The structure we present to OS/2 TCPIP.
    102102 *                  This will be initialized.
    103  */
    104 static inline int convert(int c, int cb, const struct fd_set *pFrom, struct my_fd_set *pTo)
     103 * @param   pszType Typestring to use in the log.
     104 */
     105static inline int convert(int c, int cb, const struct fd_set *pFrom, struct my_fd_set *pTo, const char *pszType)
    105106{
    106107    int i;
     
    112113            PLIBCSOCKETFH   pFHSocket = __libsocket_FH(i);
    113114            if (!pFHSocket)
     115            {
     116                LIBCLOG_MSG2("Invalid handle %d specified (%s).\n", i, pszType);
    114117                return -1;
     118            }
    115119            MY_FD_SET(pFHSocket->iSocket, pTo);
    116         }
    117     }
     120            LIBCLOG_MSG2("%s: %02d -> %03d\n", pszType, i, pFHSocket->iSocket);
     121        }
     122    }
     123    pszType = pszType;
    118124    return 0;
    119125}
     
    126132 * @param   pTo     The structure passed in to select which have to
    127133 *                  be updated for the return.
    128  */
    129 static inline void update(int c, const struct my_fd_set *pFrom, struct fd_set *pTo)
     134 * @param   pszType Typestring to use in the log.
     135 */
     136static inline void update(int c, const struct my_fd_set *pFrom, struct fd_set *pTo, const char *pszType)
    130137{
    131138    int i;
     
    138145            {
    139146                if (!MY_FD_ISSET(pFHSocket->iSocket, pFrom))
     147                {
    140148                    FD_CLR(i, pTo);
     149                    LIBCLOG_MSG2("%s: %02d -> %03d set\n", pszType, i, pFHSocket->iSocket);
     150                }
     151                else
     152                    LIBCLOG_MSG2("%s: %02d -> %03d clear\n", pszType, i, pFHSocket->iSocket);
    141153            }
    142154        }
    143155    }
     156    pszType = pszType;
    144157}
    145158
     
    222235    if (readfds)
    223236    {
    224         if (convert(nfds, cb, readfds, pRead))
    225             LIBCLOG_RETURN_INT(-1);
    226     }
    227 
    228     if (writefds)
    229     {
    230         if (convert(nfds, cb, writefds, pWrite))
    231             LIBCLOG_RETURN_INT(-1);
    232     }
    233 
    234     if (exceptfds)
    235     {
    236         if (convert(nfds, cb, exceptfds, pExcept))
     237        if (convert(nfds, cb, readfds, pRead, "read "))
     238            LIBCLOG_RETURN_INT(-1);
     239    }
     240
     241    if (writefds)
     242    {
     243        if (convert(nfds, cb, writefds, pWrite, "write"))
     244            LIBCLOG_RETURN_INT(-1);
     245    }
     246
     247    if (exceptfds)
     248    {
     249        if (convert(nfds, cb, exceptfds, pExcept, "excpt"))
    237250            LIBCLOG_RETURN_INT(-1);
    238251    }
     
    241254     * Do the call.
    242255     */
     256    LIBCLOG_MSG("calling native: cFDs=%d pRead=%p pWrite=%p, pExcept=%p tv=%p\n",
     257                cFDs, pRead, pWrite, pExcept, tv);
    243258    rc = __libsocket_bsdselect(cFDs, pRead, pWrite, pExcept, tv);
    244259    if (rc < 0)
     
    268283     */
    269284    if (readfds)
    270         update(nfds, pRead, readfds);
    271     if (writefds)
    272         update(nfds, pWrite, writefds);
    273     if (exceptfds)
    274         update(nfds, pExcept, exceptfds);
     285        update(nfds, pRead, readfds, "read ");
     286    if (writefds)
     287        update(nfds, pWrite, writefds, "write");
     288    if (exceptfds)
     289        update(nfds, pExcept, exceptfds, "excpt");
    275290
    276291    LIBCLOG_RETURN_INT(rc);
Note: See TracChangeset for help on using the changeset viewer.