Skip to content
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

Segmentation fault in sctp_data_received_cb #20

Open
JulienDuf opened this issue Oct 13, 2016 · 5 comments
Open

Segmentation fault in sctp_data_received_cb #20

JulienDuf opened this issue Oct 13, 2016 · 5 comments

Comments

@JulienDuf
Copy link

JulienDuf commented Oct 13, 2016

I'm trying to use librtcdc for peer to peer connection and for data transfer. The peer to peer connection works perfectly. But when one peer creates a data channel, the other peer always ends with a Segmentation fault in the sctp_data_received_cb function of stcp.c

I create my data channel in the on_connect callback :

void PeerConnection_OnConnect(PeerConnection *peer, void *user_data)
{
        App* app = (App*)user_data;
        printf("OnConnection" "\n");
        app->dataChannel = rtcdc_create_data_channel(app->connection, "data", "", PeerConnection_OnOpen, PeerConnection_OnMessage, PeerConnection_OnClose, app);
}

Am I the only one with that problem ?

@xhs
Copy link
Owner

xhs commented Oct 13, 2016

Hi @JulienDuf , could you show me the rtcdc_on_channel_cb function?

@JulienDuf
Copy link
Author

For the moment I'm doing this :

void PeerConnection_OnChannel(PeerConnection *peer, DataChannel *channel, void *user_data)
{
        printf("OnChannel" "\n");
}

But the callback is never called.

@xhs
Copy link
Owner

xhs commented Oct 13, 2016

Let me see...what if you add -DDEBUG_SCTP when you compile this code, can you see something like "data of length %zu received on stream %u with SSN %u, TSN %u, PPID %u\n"?

@JulienDuf
Copy link
Author

JulienDuf commented Oct 13, 2016

No, because the seg fault is there :

struct rtcdc_transport *transport = peer->transport;

When the program is in this function, every parameters are invalid (they have junk in them).

This might be a problem of multithreading, two threads working with the sctp transport at the same time.

@xhs
Copy link
Owner

xhs commented Oct 14, 2016

The name user_data in sctp_data_received_cb is confusing, I have renamed it to peer_data. Generally, it should not be touched. I will look into it. :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants