Looking for info about `Desc->active_count` in `inet_drv.c`

Hi for everybody, I have a question about the driver inet_drv.c I just can’t find the part of code that decrease the desc->active_count after receiving Data on a Socket that have been set with {active,N} ?

In fact when Data arrives to the Socket, the Kernel will trigger this function that results in this match, after that, tcp_recv function will results in tcp_deliver function and this last will result in tcp_reply_data function that will check via the function inet_check_active_to_passive if we must switch from active to passive and this is the code of this function, but the desc->active_count should have already set before running this function so I can’t find where it have been decreased, any help I will be thankful.


The INET_CHECK_ACTIVE_TO_PASSIVE macro decreases the active_count as a side-effect in the second if:

/* check for transition from active to passive */
#define INET_CHECK_ACTIVE_TO_PASSIVE(inet)                              \
    do {                                                                \
        if ((inet)->active == INET_ONCE)                                \
            (inet)->active = INET_PASSIVE;                              \
        else if ((inet)->active == INET_MULTI && --((inet)->active_count) == 0) { \
            (inet)->active = INET_PASSIVE;                              \
            packet_passive_message(inet);                               \
        }                                                               \
    } while (0)

with the --((inet)->active_count) == 0.


Oh yes I just didn’t see the -- so Thank you @filmor

1 Like