Commit f25294b364fe194579475b3b9bdc4ba5c9977767

Authored by Wesnydy Ribeiro
1 parent 6a447a03
Exists in master and in 1 other branch devel

Corrige contador de tentativas de conexão

Showing 1 changed file with 6 additions and 5 deletions   Show diff stats
renderer/src/renderer.cpp
1 1 #include "renderer.h"
2   -#include <iostream>
3 2  
4 3 Renderer::Renderer(char* path_Contents, char* id) {
5 4 this->pathOutVideo = path_Contents;
... ... @@ -41,7 +40,6 @@ void Renderer::executeServerScript() {
41 40  
42 41 command.append(" && ").append("python render.py ")
43 42 .append(userID).append(" >/dev/null 2>&1 &");
44   -
45 43 system(command.c_str());
46 44 }
47 45  
... ... @@ -53,11 +51,14 @@ void Renderer::connectToUnityPlayer() {
53 51 PRINTL(util::_DEBUG, "Conectando ao UnityPlayer...\n");
54 52 while(!cSocket->isConnected()){
55 53 try{
  54 +
56 55 cSocket->connect(addr, PORT);
57   - i++;
58   - sleep(1);
  56 +
59 57 }catch(lavidlib::SocketException &ex){
60   - if(i == 10){ // Numeros de tentativas (pode ser alterado)
  58 + if(i < 10) { // Numeros de tentativas de conexão (pode ser alterado)
  59 + i++;
  60 + sleep(1);
  61 + }else{
61 62 PRINTL(util::_ERROR, "Número de tentativas de conexão excedido!\n");
62 63 throw lavidlib::RuntimeException(ex.getMessage().c_str());
63 64 }
... ...