more fixes and cleanups for dna lookup.

This commit is contained in:
gardners 2012-05-18 13:44:15 +09:30
parent c9a58937ca
commit e38275067a
2 changed files with 20 additions and 9 deletions

View File

@ -473,7 +473,6 @@ int overlay_saw_mdp_frame(int interface, overlay_mdp_frame *mdp,long long now)
bcopy(mdp_bindings_sockets[match],&addr.sun_path[0],mdp_bindings_socket_name_lengths[match]);
addr.sun_family=AF_UNIX;
int r=sendto(mdp_named_socket,mdp,overlay_mdp_relevant_bytes(mdp),0,(struct sockaddr*)&addr,sizeof(addr));
printf("r=%d\n",r);
if (r==overlay_mdp_relevant_bytes(mdp)) return 0;
WHY_perror("sendto(e)");
return WHY("Failed to pass received MDP frame to client");
@ -506,7 +505,6 @@ int overlay_saw_mdp_frame(int interface, overlay_mdp_frame *mdp,long long now)
overlay_mdp_swap_src_dst(mdp);
while(keyring_find_did(keyring,&cn,&in,&kp,did))
{
WHYF("Found matching did");
/* package DID and Name into reply (we include the DID because
it could be a wild-card DID search, but the SID is implied
in the source address of our reply). */

View File

@ -248,15 +248,21 @@ int overlay_payload_enqueue(int q,overlay_frame *p,int forceBroadcastP)
/* Dispatch voice data immediately. */
int interface=-1;
int nexthoplen=SID_SIZE;
int broadcast=overlay_address_is_broadcast(p->destination);
overlay_abbreviate_clear_most_recent_address();
if (overlay_get_nexthop(p->destination,p->nexthop,&nexthoplen,
&interface)) {
return WHY("Failed to resolve nexthop for voice packet");
}
if (interface==-1) {
return WHY("Failed to determine interface for sending voice packet");
if (broadcast) {
bcopy(p->destination,p->nexthop,SID_SIZE);
interface=0;
} else {
if (overlay_get_nexthop(p->destination,p->nexthop,&nexthoplen,
&interface)) {
return WHY("Failed to resolve nexthop for voice packet");
}
if (interface==-1&&(!broadcast)) {
return WHY("Failed to determine interface for sending voice packet");
}
}
overlay_buffer *b=ob_new(overlay_interfaces[interface].mtu);
@ -273,6 +279,7 @@ int overlay_payload_enqueue(int q,overlay_frame *p,int forceBroadcastP)
if (debug&DEBUG_OVERLAYINTERFACES)
WHYF("Sending %d byte voice packet",b->length);
nextinterface:
if (!overlay_broadcast_ensemble(interface,NULL,b->bytes,b->length))
{
overlay_update_sequence_number();
@ -287,6 +294,12 @@ int overlay_payload_enqueue(int q,overlay_frame *p,int forceBroadcastP)
ob_free(b);
return -1;
}
if (broadcast) {
interface++;
if (interface<overlay_interface_count) goto nextinterface;
}
}
if (q<0||q>=OQ_MAX) return WHY("Invalid queue specified");