[[using locked(this->m_GroupLock)]]
| 1965 | |
| 1966 | // [[using locked(this->m_GroupLock)]] |
| 1967 | void CUDTGroup::copyGroupData(const CUDTGroup::SocketData& source, SRT_SOCKGROUPDATA& w_target) |
| 1968 | { |
| 1969 | w_target.id = source.id; |
| 1970 | memcpy((&w_target.peeraddr), &source.peer, source.peer.size()); |
| 1971 | |
| 1972 | w_target.sockstate = source.laststatus; |
| 1973 | w_target.token = source.token; |
| 1974 | |
| 1975 | // In the internal structure the member state |
| 1976 | // is one per direction. From the user perspective |
| 1977 | // however it is used either in one direction only, |
| 1978 | // in which case the one direction that is active |
| 1979 | // matters, or in both directions, in which case |
| 1980 | // it will be always either both active or both idle. |
| 1981 | |
| 1982 | if (source.sndstate == SRT_GST_RUNNING || source.rcvstate == SRT_GST_RUNNING) |
| 1983 | { |
| 1984 | w_target.result = 0; |
| 1985 | w_target.memberstate = SRT_GST_RUNNING; |
| 1986 | } |
| 1987 | // Stats can differ per direction only |
| 1988 | // when at least in one direction it's ACTIVE. |
| 1989 | else if (source.sndstate == SRT_GST_BROKEN || source.rcvstate == SRT_GST_BROKEN) |
| 1990 | { |
| 1991 | w_target.result = -1; |
| 1992 | w_target.memberstate = SRT_GST_BROKEN; |
| 1993 | } |
| 1994 | else |
| 1995 | { |
| 1996 | // IDLE or PENDING |
| 1997 | w_target.result = 0; |
| 1998 | w_target.memberstate = source.sndstate; |
| 1999 | } |
| 2000 | |
| 2001 | w_target.weight = source.weight; |
| 2002 | } |
| 2003 | |
| 2004 | void CUDTGroup::getGroupCount(size_t& w_size, bool& w_still_alive) |
| 2005 | { |