Skip to content

Commit

Permalink
[core] Fixed a bug repeating a conclusion HS with rejection (#1650)
Browse files Browse the repository at this point in the history
  • Loading branch information
ethouris committed Dec 10, 2020
1 parent c065d88 commit 0a61cb9
Show file tree
Hide file tree
Showing 4 changed files with 235 additions and 138 deletions.
7 changes: 6 additions & 1 deletion srtcore/api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -490,9 +490,10 @@ SRTSOCKET CUDTUnited::newSocket(CUDTSocket** pps)
}

int CUDTUnited::newConnection(const SRTSOCKET listen, const sockaddr_any& peer, const CPacket& hspkt,
CHandShake& w_hs, int& w_error)
CHandShake& w_hs, int& w_error, CUDT*& w_acpu)
{
CUDTSocket* ns = NULL;
w_acpu = NULL;

w_error = SRT_REJ_IPE;

Expand Down Expand Up @@ -534,6 +535,10 @@ int CUDTUnited::newConnection(const SRTSOCKET listen, const sockaddr_any& peer,
w_hs.m_iReqType = URQ_CONCLUSION;
w_hs.m_iID = ns->m_SocketID;

// Report the original UDT because it will be
// required to complete the HS data for conclusion response.
w_acpu = ns->m_pUDT;

return 0;

//except for this situation a new connection should be started
Expand Down
4 changes: 3 additions & 1 deletion srtcore/api.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,12 @@ friend class CRendezvousQueue;
/// @param [in] listen the listening UDT socket;
/// @param [in] peer peer address.
/// @param [in,out] hs handshake information from peer side (in), negotiated value (out);
/// @param [out] w_error error code when failed
/// @param [out] w_acpu entity of accepted socket, if connection already exists
/// @return If the new connection is successfully created: 1 success, 0 already exist, -1 error.

int newConnection(const SRTSOCKET listen, const sockaddr_any& peer, const CPacket& hspkt,
CHandShake& w_hs, int& w_error);
CHandShake& w_hs, int& w_error, CUDT*& w_acpu);

int installAcceptHook(const SRTSOCKET lsn, srt_listen_callback_fn* hook, void* opaq);
int installConnectHook(const SRTSOCKET lsn, srt_connect_callback_fn* hook, void* opaq);
Expand Down
Loading

0 comments on commit 0a61cb9

Please sign in to comment.