fix problems with the server not binding to the correct interface

metadata
Wenzel Jakob 2010-08-27 20:21:08 +02:00
parent 723e8d951f
commit e191ea43c9
3 changed files with 8 additions and 5 deletions

View File

@ -188,9 +188,9 @@ void GLProgram::setParameter(int id, const Transform &trafo) {
(trafo.getMatrix()->m));
#else
GLfloat tmp[16];
int i, j, idx=0;
for (i=0; i<4; i++)
for (j=0; j<4; j++)
int idx=0;
for (int i=0; i<4; i++)
for (int j=0; j<4; j++)
tmp[idx++] = (GLfloat) trafo.getMatrix()->m[i][j];
glUniformMatrix4fv(id, 1, true, tmp);
#endif

View File

@ -80,6 +80,7 @@ int ubi_main(int argc, char **argv) {
ELogLevel logLevel = EInfo;
std::string hostName = getFQDN();
FileResolver *resolver = FileResolver::getInstance();
bool hostNameSet = false;
optind = 1;
/* Parse command-line arguments */
@ -96,6 +97,7 @@ int ubi_main(int argc, char **argv) {
break;
case 'i':
hostName = optarg;
hostNameSet = true;
break;
case 's': {
std::ifstream is(optarg);
@ -255,7 +257,7 @@ int ubi_main(int argc, char **argv) {
sock = INVALID_SOCKET;
snprintf(portName, sizeof(portName), "%i", listenPort);
if ((rv = getaddrinfo(hostName.c_str(), portName, &hints, &servinfo)) != 0)
if ((rv = getaddrinfo(hostNameSet ? hostName.c_str() : NULL, portName, &hints, &servinfo)) != 0)
SLog(EError, "Error in getaddrinfo(%s:%i): %s", hostName.c_str(), listenPort, gai_strerror(rv));
for (p = servinfo; p != NULL; p = p->ai_next) {

View File

@ -28,9 +28,10 @@ void ServerThread::run() {
int rv, one = 1;
m_socket = INVALID_SOCKET;
m_active = true;
bool hostNameSet = m_nodeName != getFQDN();
snprintf(portName, sizeof(portName), "%i", m_listenPort);
if ((rv = getaddrinfo(m_nodeName.c_str(), portName, &hints, &servinfo)) != 0)
if ((rv = getaddrinfo(hostNameSet ? m_nodeName.c_str() : NULL, portName, &hints, &servinfo)) != 0)
SLog(EError, "Error in getaddrinfo(%s:%i): %s", m_nodeName.c_str(), m_listenPort, gai_strerror(rv));
for (p = servinfo; p != NULL; p = p->ai_next) {