along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id: protocol_edge.c,v 1.1.4.2 2002/02/18 16:25:18 guus Exp $
+ $Id: protocol_edge.c,v 1.1.4.3 2002/03/21 23:11:53 guus Exp $
*/
#include "config.h"
sockaddr2str(&e->from.udpaddress, &from_udpaddress, &from_udpport);
sockaddr2str(&e->to.tcpaddress, &to_tcpaddress, &to_tcpport);
sockaddr2str(&e->to.udpaddress, &to_udpaddress, &to_udpport);
- x = send_request(c, "%d %s %s %s %s %s %s %s %s %lx %d", ADD_EDGE,
+ x = send_request(c, "%d %lx %s %s %s %s %s %s %s %s %lx %d", ADD_EDGE, random(),
e->from.node->name, from_tcpaddress, from_tcpport, from_udpport,
e->to.node->name, to_tcpaddress, to_tcpport, to_udpport,
e->options, e->weight);
int weight;
avl_node_t *node;
cp
- if(sscanf(c->buffer, "%*d "MAX_STRING" "MAX_STRING" "MAX_STRING" "MAX_STRING" "MAX_STRING" "MAX_STRING" "MAX_STRING" "MAX_STRING" %lx %d",
+ if(sscanf(c->buffer, "%*d %*lx "MAX_STRING" "MAX_STRING" "MAX_STRING" "MAX_STRING" "MAX_STRING" "MAX_STRING" "MAX_STRING" "MAX_STRING" %lx %d",
from_name, from_address, from_tcpport, from_udpport,
to_name, to_address, to_tcpport, to_udpport,
&options, &weight) != 10)
return -1;
}
+ if(seen_request(c->buffer))
+ return 0;
+
/* Lookup nodes */
from = lookup_node(from_name);
return 0;
}
-
-
e = new_edge();
e->from.node = from;
e->from.tcpaddress = from_tcpaddress;
{
other = (connection_t *)node->data;
if(other->status.active && other != c)
- send_add_edge(other, e);
+ send_request(other, "%s", c->buffer);
}
/* Run MST before or after we tell the rest? */
int send_del_edge(connection_t *c, edge_t *e)
{
cp
- return send_request(c, "%d %s %s", DEL_EDGE,
+ return send_request(c, "%d %lx %s %s", DEL_EDGE, random(),
e->from.node->name, e->to.node->name);
}
connection_t *other;
avl_node_t *node;
cp
- if(sscanf(c->buffer, "%*d "MAX_STRING" "MAX_STRING"", from_name, to_name) != 2)
+ if(sscanf(c->buffer, "%*d %*lx "MAX_STRING" "MAX_STRING"", from_name, to_name) != 2)
{
syslog(LOG_ERR, _("Got bad %s from %s (%s)"), "DEL_EDGE",
c->name, c->hostname);
return -1;
}
+ if(seen_request(c->buffer))
+ return 0;
+
/* Lookup nodes */
from = lookup_node(from_name);
{
other = (connection_t *)node->data;
if(other->status.active && other != c)
- send_del_edge(other, e);
+ send_request(other, "%s", c->buffer);
}
/* Delete the edge */