Beispiel #1
0
void findVisibleCandidates(CallInfo&                  info,
                           Vec<FnSymbol*>&            visibleFns,
                           Vec<ResolutionCandidate*>& candidates) {
  // Search user-defined (i.e. non-compiler-generated) functions first.
  gatherCandidates(info, visibleFns, false, candidates);

  // If no results, try again with any compiler-generated candidates.
  if (candidates.n == 0) {
    gatherCandidates(info, visibleFns, true, candidates);
  }
}
Beispiel #2
0
int main(int argc, char *argv[])
{
    struct timespec timer;
    struct timespec remaining;

    int proxy_fd, media_fd;
    char c;
    char offer[500];
    int offerLen;
    struct turnData tData;


    if (argc != 5) {
        fprintf(stderr,"usage: iceclient registrar turnserver user pass\n");
        exit(1);
    }

    proxy_fd = connectProxy(argv[1]);

    tData.turn_uri = argv[2];
    tData.turn_port = "3478";
    tData.user = argv[3];
    tData.password = argv[4];

        
    while(1){
        printf( "Press c (enter) to call (Or wait for a incomming call) :");
        c = getchar( );

        if(c == 'c'){
            printf("Calling...");
            gatherCandidates(&tData);
            while(tData.turn_state!=SUCCESS){
                timer.tv_sec = 0;
                timer.tv_nsec = 50000000;
                nanosleep(&timer, &remaining);
            }

            printf("Got it...");
            offerLen = createOffer(offer, &tData);

            sendOffer(proxy_fd, offer, offerLen);
        }
        if(c == 'e'){
            closeProxy(proxy_fd);
            exit(0);
        }

    }
}
void GameSession::processNewPlayer (DPID id) {
  g_debug("[GameSession::processNewPlayer] %ld", id);
  auto player = new RemotePlayer(this, id);
  g_object_set(player->agent->unwrap(), "controlling-mode", this->isHost ? 1 : 0, NULL);

  auto stream = player->agent->addStream(1);
  stream->setName("application");
  stream->attachRecv(1, g_main_loop_get_context(mainLoop), onReceiveNicePacket, player);

  this->players.push_back(player);
  // The game host is always the name server for now.
  if (!this->isHost && this->players.size() == 1) {
    this->setNameServer(id);
  }

  stream->gatherCandidates();
}