1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-15 04:42:04 +00:00
srs/trunk/3rdparty/srt-1-fit/srtcore/group_common.cpp
john fe086dfc31
SRT: Upgrade libsrt from 1.4.1 to 1.5.1. v6.0.12 (#3362)
Co-authored-by: winlin <winlin@vip.126.com>
2023-01-04 19:56:33 +08:00

63 lines
1.9 KiB
C++

/*
* SRT - Secure, Reliable, Transport
* Copyright (c) 2021 Haivision Systems Inc.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
*/
/*****************************************************************************
Written by
Haivision Systems Inc.
*****************************************************************************/
#include "platform_sys.h"
#include "group_common.h"
#include "api.h"
namespace srt
{
namespace groups
{
SocketData prepareSocketData(CUDTSocket* s)
{
// This uses default SRT_GST_BROKEN because when the group operation is done,
// then the SRT_GST_IDLE state automatically turns into SRT_GST_RUNNING. This is
// recognized as an initial state of the fresh added socket to the group,
// so some "initial configuration" must be done on it, after which it's
// turned into SRT_GST_RUNNING, that is, it's treated as all others. When
// set to SRT_GST_BROKEN, this socket is disregarded. This socket isn't cleaned
// up, however, unless the status is simultaneously SRTS_BROKEN.
// The order of operations is then:
// - add the socket to the group in this "broken" initial state
// - connect the socket (or get it extracted from accept)
// - update the socket state (should be SRTS_CONNECTED)
// - once the connection is established (may take time with connect), set SRT_GST_IDLE
// - the next operation of send/recv will automatically turn it into SRT_GST_RUNNING
SocketData sd = {
s->m_SocketID,
s,
-1,
SRTS_INIT,
SRT_GST_BROKEN,
SRT_GST_BROKEN,
-1,
-1,
sockaddr_any(),
sockaddr_any(),
false,
false,
false,
0, // weight
0 // pktSndDropTotal
};
return sd;
}
} // namespace groups
} // namespace srt