A number of bugfixes for the recent threading updates.

All tests pass now except one:

scripts.base.frameworks.metrics.cluster-intermediate-update

Couldn't figure out yet why that still fails.
This commit is contained in:
Robin Sommer 2012-02-29 14:32:29 -08:00
parent 629ec31ec2
commit df874f0f62
5 changed files with 63 additions and 28 deletions

View file

@ -47,7 +47,7 @@ public:
*
* @param in6 The IPv6 address.
*/
IPAddr(const in4_addr& in4)
explicit IPAddr(const in4_addr& in4)
{
memcpy(in6.s6_addr, v4_mapped_prefix, sizeof(v4_mapped_prefix));
memcpy(&in6.s6_addr[12], &in4.s_addr, sizeof(in4.s_addr));
@ -58,7 +58,7 @@ public:
*
* @param in6 The IPv6 address.
*/
IPAddr(const in6_addr& arg_in6) : in6(arg_in6) { }
explicit IPAddr(const in6_addr& arg_in6) : in6(arg_in6) { }
/**
* Constructs an address instance from a string representation.
@ -523,8 +523,6 @@ public:
*/
string AsString() const;
/** Converts the address into the type used internally by the inter-thread communicastion.
*/
operator std::string() const { return AsString(); }
/**

View file

@ -295,7 +295,6 @@ bool BinarySerializationFormat::Read(struct in6_addr* addr, const char* tag)
return true;
}
bool BinarySerializationFormat::Write(char v, const char* tag)
{
DBG_LOG(DBG_SERIAL, "Write char %s [%s]", fmt_bytes(&v, 1), tag);
@ -389,10 +388,9 @@ bool BinarySerializationFormat::Write(const IPPrefix& prefix, const char* tag)
return Write(prefix.Prefix(), "prefix") && Write(prefix.Length(), "width");
}
bool BinarySerializationFormat::Write(struct in_addr& addr, const char* tag)
bool BinarySerializationFormat::Write(const struct in_addr& addr, const char* tag)
{
const uint32_t* bytes;
bytes = (uint32_t*) &addr.s_addr;
const uint32_t* bytes = (uint32_t*) &addr.s_addr;
if ( ! Write(ntohl(bytes[0]), "addr4") )
return false;
@ -400,10 +398,9 @@ bool BinarySerializationFormat::Write(struct in_addr& addr, const char* tag)
return true;
}
bool BinarySerializationFormat::Write(struct in6_addr& addr, const char* tag)
bool BinarySerializationFormat::Write(const struct in6_addr& addr, const char* tag)
{
const uint32_t* bytes;
bytes = (uint32_t*) &addr.s6_addr;
const uint32_t* bytes = (uint32_t*) &addr.s6_addr;
for ( int i = 0; i < 4; ++i )
{
@ -620,13 +617,13 @@ bool XMLSerializationFormat::Write(const IPPrefix& prefix, const char* tag)
return false;
}
bool XMLSerializationFormat::Write(struct in_addr& addr, const char* tag)
bool XMLSerializationFormat::Write(const struct in_addr& addr, const char* tag)
{
reporter->InternalError("XML output of in_addr not implemented");
return false;
}
bool XMLSerializationFormat::Write(struct in6_addr& addr, const char* tag)
bool XMLSerializationFormat::Write(const struct in6_addr& addr, const char* tag)
{
reporter->InternalError("XML output of in6_addr not implemented");
return false;

View file

@ -59,8 +59,8 @@ public:
virtual bool Write(const string& s, const char* tag) = 0;
virtual bool Write(const IPAddr& addr, const char* tag) = 0;
virtual bool Write(const IPPrefix& prefix, const char* tag) = 0;
virtual bool Write(struct in_addr& addr, const char* tag) = 0;
virtual bool Write(struct in6_addr& addr, const char* tag) = 0;
virtual bool Write(const struct in_addr& addr, const char* tag) = 0;
virtual bool Write(const struct in6_addr& addr, const char* tag) = 0;
virtual bool WriteOpenTag(const char* tag) = 0;
virtual bool WriteCloseTag(const char* tag) = 0;
@ -118,8 +118,8 @@ public:
virtual bool Write(const string& s, const char* tag);
virtual bool Write(const IPAddr& addr, const char* tag);
virtual bool Write(const IPPrefix& prefix, const char* tag);
virtual bool Write(struct in_addr& addr, const char* tag);
virtual bool Write(struct in6_addr& addr, const char* tag);
virtual bool Write(const struct in_addr& addr, const char* tag);
virtual bool Write(const struct in6_addr& addr, const char* tag);
virtual bool WriteOpenTag(const char* tag);
virtual bool WriteCloseTag(const char* tag);
virtual bool WriteSeparator();
@ -144,8 +144,8 @@ public:
virtual bool Write(const string& s, const char* tag);
virtual bool Write(const IPAddr& addr, const char* tag);
virtual bool Write(const IPPrefix& prefix, const char* tag);
virtual bool Write(struct in_addr& addr, const char* tag);
virtual bool Write(struct in6_addr& addr, const char* tag);
virtual bool Write(const struct in_addr& addr, const char* tag);
virtual bool Write(const struct in6_addr& addr, const char* tag);
virtual bool WriteOpenTag(const char* tag);
virtual bool WriteCloseTag(const char* tag);
virtual bool WriteSeparator();

View file

@ -106,8 +106,11 @@ void Manager::Process()
Message* msg = t->RetrieveOut();
if ( msg->Process() && network_time )
if ( msg->Process() )
{
if ( network_time )
did_process = true;
}
else
{

View file

@ -147,7 +147,7 @@ bool Value::Read(SerializationFormat* fmt)
case TYPE_ADDR:
{
int family;
char family;
if ( ! fmt->Read(&family, "addr-family") )
return false;
@ -169,7 +169,27 @@ bool Value::Read(SerializationFormat* fmt)
case TYPE_SUBNET:
{
// FIXME.
char length;
char family;
if ( ! (fmt->Read(&length, "subnet-len") && fmt->Read(&family, "subnet-family")) )
return false;
switch ( family ) {
case 4:
val.subnet_val.length = (uint8_t)length;
val.subnet_val.prefix.family = IPv4;
return fmt->Read(&val.subnet_val.prefix.in.in4, "subnet-in4");
case 6:
val.subnet_val.length = (uint8_t)length;
val.subnet_val.prefix.family = IPv6;
return fmt->Read(&val.subnet_val.prefix.in.in6, "subnet-in6");
}
// Can't be reached.
abort();
}
case TYPE_DOUBLE:
@ -250,18 +270,15 @@ bool Value::Write(SerializationFormat* fmt) const
case TYPE_PORT:
return fmt->Write(val.port_val.port, "port") && fmt->Write(val.port_val.proto, "proto");
case TYPE_SUBNET:
return false; // FIXME.
case TYPE_ADDR:
{
switch ( val.addr_val.family ) {
case IPv4:
return fmt->Write((int)4, "addr-family")
return fmt->Write((char)4, "addr-family")
&& fmt->Write(val.addr_val.in.in4, "addr-in4");
case IPv6:
return fmt->Write((int)6, "addr-family")
return fmt->Write((char)6, "addr-family")
&& fmt->Write(val.addr_val.in.in6, "addr-in6");
break;
}
@ -270,6 +287,26 @@ bool Value::Write(SerializationFormat* fmt) const
abort();
}
case TYPE_SUBNET:
{
if ( ! fmt->Write((char)val.subnet_val.length, "subnet-length") )
return false;
switch ( val.subnet_val.prefix.family ) {
case IPv4:
return fmt->Write((char)4, "subnet-family")
&& fmt->Write(val.subnet_val.prefix.in.in4, "subnet-in4");
case IPv6:
return fmt->Write((char)6, "subnet-family")
&& fmt->Write(val.subnet_val.prefix.in.in6, "subnet-in6");
break;
}
// Can't be reached.
abort();
}
case TYPE_DOUBLE:
case TYPE_TIME:
case TYPE_INTERVAL: