|
@@ -89,10 +89,13 @@ int main(int argc, char **argv) {
|
|
int command = -1;
|
|
int command = -1;
|
|
// int check_scan
|
|
// int check_scan
|
|
if (scanf("%d", &command)){
|
|
if (scanf("%d", &command)){
|
|
|
|
+
|
|
|
|
|
|
}else {
|
|
}else {
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
|
|
+ while ((c = getchar()) != '\n' && c != EOF) { }
|
|
|
|
+
|
|
fflush(stdin);
|
|
fflush(stdin);
|
|
switch (command) {
|
|
switch (command) {
|
|
case 0: {
|
|
case 0: {
|
|
@@ -128,7 +131,6 @@ int main(int argc, char **argv) {
|
|
char* candidate = NULL;
|
|
char* candidate = NULL;
|
|
size_t candidate_size = 0;
|
|
size_t candidate_size = 0;
|
|
int c;
|
|
int c;
|
|
- while ((c = getchar()) != '\n' && c != EOF) { }
|
|
|
|
if(getline(&candidate, &candidate_size, stdin)){
|
|
if(getline(&candidate, &candidate_size, stdin)){
|
|
rtcAddRemoteCandidate(peer->pc, candidate, "1");
|
|
rtcAddRemoteCandidate(peer->pc, candidate, "1");
|
|
free(candidate);
|
|
free(candidate);
|
|
@@ -150,7 +152,6 @@ int main(int argc, char **argv) {
|
|
char* message = NULL;
|
|
char* message = NULL;
|
|
size_t message_size = 0;
|
|
size_t message_size = 0;
|
|
int c;
|
|
int c;
|
|
- while ((c = getchar()) != '\n' && c != EOF) { }
|
|
|
|
if(getline(&message, &message_size, stdin)){
|
|
if(getline(&message, &message_size, stdin)){
|
|
rtcSendMessage(peer->dc, message, -1);
|
|
rtcSendMessage(peer->dc, message, -1);
|
|
free(message);
|
|
free(message);
|
|
@@ -228,11 +229,7 @@ static void closedCallback(void *ptr) {
|
|
Peer *peer = (Peer *)ptr;
|
|
Peer *peer = (Peer *)ptr;
|
|
peer->connected = false;
|
|
peer->connected = false;
|
|
|
|
|
|
- // char buffer[256];
|
|
|
|
-
|
|
|
|
- // if (rtcGetDataChannelLabel(peer->dc, buffer, 256) >= 0)
|
|
|
|
- // printf("DataChannel %s: Received with label \"%s\"\n","answerer", buffer);
|
|
|
|
- //
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
static void messageCallback(const char *message, int size, void *ptr) {
|
|
static void messageCallback(const char *message, int size, void *ptr) {
|
|
// Peer *peer = (Peer *)ptr;
|
|
// Peer *peer = (Peer *)ptr;
|