Fixed Controller compiling, upped socket lib verbosity, fixed JSON::Value null -> string convert, fixed Makefile install command.

This commit is contained in:
Thulinma 2012-04-28 00:51:21 +02:00
parent fffcf598c4
commit 8b15fd52c4
2 changed files with 11 additions and 7 deletions

View file

@ -253,9 +253,13 @@ JSON::Value::operator long long int(){
JSON::Value::operator std::string(){
if (myType == STRING){
return strVal;
}else{
if (myType == EMPTY){
return "";
}else{
return toString();
}
}
}
/// Retrieves or sets the JSON::Value at this position in the object.

View file

@ -454,7 +454,7 @@ Socket::Server::Server(int port, std::string hostname, bool nonblock){
sock = socket(AF_INET6, SOCK_STREAM, 0);
if (sock < 0){
#if DEBUG >= 1
fprintf(stderr, "Could not create socket! Error: %s\n", strerror(errno));
fprintf(stderr, "Could not create socket %s:%i! Error: %s\n", hostname.c_str(), port, strerror(errno));
#endif
return;
}
@ -468,7 +468,7 @@ Socket::Server::Server(int port, std::string hostname, bool nonblock){
struct sockaddr_in6 addr;
addr.sin6_family = AF_INET6;
addr.sin6_port = htons(port);//set port
if (hostname == "0.0.0.0"){
if (hostname == "0.0.0.0" || hostname.length() == 0){
addr.sin6_addr = in6addr_any;
}else{
inet_pton(AF_INET6, hostname.c_str(), &addr.sin6_addr);//set interface, 0.0.0.0 (default) is all
@ -487,14 +487,14 @@ Socket::Server::Server(int port, std::string hostname, bool nonblock){
}
}else{
#if DEBUG >= 1
fprintf(stderr, "Binding failed, retrying as IPv4... (%s)\n", strerror(errno));
fprintf(stderr, "Binding %s:%i failed, retrying as IPv4... (%s)\n", hostname.c_str(), port, strerror(errno));
#endif
close();
}
sock = socket(AF_INET, SOCK_STREAM, 0);
if (sock < 0){
#if DEBUG >= 1
fprintf(stderr, "Could not create socket! Error: %s\n", strerror(errno));
fprintf(stderr, "Could not create socket %s:%i! Error: %s\n", hostname.c_str(), port, strerror(errno));
#endif
return;
}
@ -508,7 +508,7 @@ Socket::Server::Server(int port, std::string hostname, bool nonblock){
struct sockaddr_in addr4;
addr4.sin_family = AF_INET;
addr4.sin_port = htons(port);//set port
if (hostname == "0.0.0.0"){
if (hostname == "0.0.0.0" || hostname.length() == 0){
addr4.sin_addr.s_addr = INADDR_ANY;
}else{
inet_pton(AF_INET, hostname.c_str(), &addr4.sin_addr);//set interface, 0.0.0.0 (default) is all
@ -527,7 +527,7 @@ Socket::Server::Server(int port, std::string hostname, bool nonblock){
}
}else{
#if DEBUG >= 1
fprintf(stderr, "IPv4 binding also failed, giving up. (%s)\n", strerror(errno));
fprintf(stderr, "IPv4 binding %s:%i also failed, giving up. (%s)\n", hostname.c_str(), port, strerror(errno));
#endif
close();
return;