-
Notifications
You must be signed in to change notification settings - Fork 851
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Peer address not available through srt_getpeername() upon epoll TX_READY event #2485
Comments
Full socket content:
|
srt_getpeername returns zeroed sockaddr even when called later, once caller is connected and steaming. |
@jeandube Could you also share what is the expected remote IP? Is it IPv6 or IPv4? Local or remote host? |
It looks like there's some confusion lagging since even UDT times here. Just to cut off confusion I have temporarily changed the name of This means that this value will be properly set in a socket extracted from a listener - and nowhere else. The The
All this means that Not sure if that is how it's supposed to work, but this is how it works, and I doubt it has ever changed. I agree that it doesn't exactly make sense because a connected socket is a connected socket, no matter if created manually and connected, or extracted from So, the easiest way to fix it would be to make |
This was a regression in 1.5.x in my case, it worked fine in 1.4.4 as well. My case is calling srt_peername on a caller socket rather early on, right after My workaround was easy, as I could just use the information I just passed to srt_connect to what I needed it for, but the OP seems to have something more subtle. |
Damn, you are perfectly right! Excerpt from /*
* In blocking mode, connect can block for up to 30 seconds for
* rendez-vous mode. Holding the s->m_ControlLock prevent close
* from cancelling the connect
*/
try
{
// record peer address
s->m_PeerAddr = target_addr; //<--------------
s->core().startConnect(target_addr, forced_isn);
}
catch (CUDTException& e) // Interceptor, just to change the state.
{
s->m_Status = SRTS_OPENED;
throw e;
}
State in /*
* In blocking mode, connect can block for up to 30 seconds for
* rendez-vous mode. Holding the s->m_ControlLock prevent close
* from cancelling the connect
*/
try
{
s->core().startConnect(target_addr, forced_isn);
}
catch (const CUDTException&) // Interceptor, just to change the state.
{
s->m_Status = SRTS_OPENED;
throw;
}
|
Hmm, I did this change in #2087 because Thus SRT v1.5.0 and v1.5.1 are affected. |
A refax request could be a good idea to resolve this duality in time, but this isn't a simple removal of a field and shifting the functions to use the other one. Indeed, they are in two different objects and also under two different mutexes. Although it could be a good idea to give them prefixes. For example for CUDT I was using |
calling socket is connected and not broken and srt_getpeername does not set name.
One can argues that peer address is known by app for a caller but this is probably a regression in 1.5.1 as this used to work.
Here a gdb session:
The text was updated successfully, but these errors were encountered: