switch new meshms to using a new service field.

remove requirement that bundles have one of the known list of
service types.
This commit is contained in:
gardners 2013-05-16 07:06:39 +09:30
parent 29d23e7dd4
commit 8eb0e0e5de
3 changed files with 7 additions and 16 deletions

View File

@ -188,7 +188,8 @@ int rhizome_manifest_check_sanity(rhizome_manifest *m_in)
const char *name = rhizome_manifest_get(m_in, "name", NULL, 0);
if (name == NULL)
return WHY("Manifest missing 'name' field");
} else if (strcasecmp(service, RHIZOME_SERVICE_MESHMS) == 0) {
} else if (strcasecmp(service, RHIZOME_SERVICE_MESHMS_OLD) == 0
|| strcasecmp(service, RHIZOME_SERVICE_MESHMS) == 0) {
if (sender == NULL || !sender[0])
return WHY("MeshMS Manifest missing 'sender' field");
if (!str_is_subscriber_id(sender))
@ -197,9 +198,7 @@ int rhizome_manifest_check_sanity(rhizome_manifest *m_in)
return WHY("MeshMS Manifest missing 'recipient' field");
if (!str_is_subscriber_id(recipient))
return WHYF("MeshMS Manifest contains invalid 'recipient' field: %s", recipient);
} else {
return WHY("Invalid service type");
}
}
if (config.debug.rhizome)
DEBUGF("sender='%s'", sender ? sender : "(null)");

View File

@ -181,7 +181,8 @@ typedef struct rhizome_manifest {
* after it is received by Rhizome.
*/
#define RHIZOME_SERVICE_FILE "file"
#define RHIZOME_SERVICE_MESHMS "MeshMS1"
#define RHIZOME_SERVICE_MESHMS_OLD "MeshMS1"
#define RHIZOME_SERVICE_MESHMS "MeshMS2"
extern long long rhizome_space;
extern unsigned short rhizome_http_server_port;

View File

@ -1457,16 +1457,6 @@ int rhizome_find_duplicate(const rhizome_manifest *m, rhizome_manifest **found,
const char *recipient = NULL;
if (service == NULL) {
return WHY("Manifest has no service");
} else if (strcasecmp(service, RHIZOME_SERVICE_FILE) == 0) {
name = rhizome_manifest_get(m, "name", NULL, 0);
if (!name) return WHY("Manifest has no name");
} else if (strcasecmp(service, RHIZOME_SERVICE_MESHMS) == 0) {
sender = rhizome_manifest_get(m, "sender", NULL, 0);
recipient = rhizome_manifest_get(m, "recipient", NULL, 0);
if (!sender) return WHY("Manifest has no sender");
if (!recipient) return WHY("Manifest has no recipient");
} else {
return WHYF("Unsupported service '%s'", service);
}
char sqlcmd[1024];
strbuf b = strbuf_local(sqlcmd, sizeof sqlcmd);
@ -1585,7 +1575,8 @@ int rhizome_find_duplicate(const rhizome_manifest *m, rhizome_manifest **found,
strbuf_sprintf(b, " name=\"%s\"", blob_name);
}else
++inconsistent;
} else if (strcasecmp(service, RHIZOME_SERVICE_MESHMS) == 0) {
}
{
const char *blob_sender = rhizome_manifest_get(blob_m, "sender", NULL, 0);
const char *blob_recipient = rhizome_manifest_get(blob_m, "recipient", NULL, 0);
if (blob_sender && !strcasecmp(blob_sender, sender) && blob_recipient && !strcasecmp(blob_recipient, recipient)) {