Renamed suc_send_uc() to suc_send(), fixed debug output

This commit is contained in:
adamdunkels 2007-03-20 12:27:32 +00:00
parent d937ff8d16
commit 558ebf3c5d
3 changed files with 16 additions and 13 deletions

View File

@ -28,7 +28,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: ruc.c,v 1.5 2007/03/19 22:10:17 adamdunkels Exp $
* $Id: ruc.c,v 1.6 2007/03/20 12:28:01 adamdunkels Exp $
*/
/**
@ -71,12 +71,12 @@ recv_from_suc(struct suc_conn *suc, rimeaddr_t *from)
struct ruc_conn *c = (struct ruc_conn *)suc;
struct ruc_hdr *hdr = rimebuf_dataptr();
DEBUGF(4, "%d: ruc: recv_from_suc type %d seqno %d\n", node_id,
DEBUGF(4, "%d: ruc: recv_from_suc type %d seqno %d\n", rimeaddr_node_addr.u16,
hdr->type, hdr->seqno);
if(hdr->type == TYPE_ACK) {
if(hdr->seqno == seqno) {
DEBUGF(4, "%d: ruc: ACKed\n", node_id);
DEBUGF(4, "%d: ruc: ACKed\n", rimeaddr_node_addr.u16);
++seqno;
suc_cancel(&c->c);
if(c->u->sent != NULL) {
@ -96,16 +96,17 @@ recv_from_suc(struct suc_conn *suc, rimeaddr_t *from)
}
if(send_ack) {
DEBUGF(4, "%d: ruc: Sending ACK to %d for %d\n", node_id, from,
DEBUGF(4, "%d: ruc: Sending ACK to %d for %d\n",
rimeaddr_node_addr.u16, from->u16,
packet_seqno);
rimebuf_clear();
rimebuf_hdrextend(sizeof(struct ruc_hdr));
hdr = rimebuf_hdrptr();
hdr->type = TYPE_ACK;
hdr->seqno = packet_seqno;
suc_send_uc(&c->c, from);
suc_send(&c->c, from);
} else {
DEBUGF(4, "%d: Not sending ACK\n", node_id);
DEBUGF(4, "%d: Not sending ACK\n", rimeaddr_node_addr.u16);
}
}
}

View File

@ -28,7 +28,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: suc.c,v 1.5 2007/03/19 22:10:17 adamdunkels Exp $
* $Id: suc.c,v 1.6 2007/03/20 12:27:32 adamdunkels Exp $
*/
/**
@ -47,7 +47,8 @@ static void
recv_from_uc(struct uc_conn *uc, rimeaddr_t *from)
{
register struct suc_conn *c = (struct suc_conn *)uc;
DEBUGF(3, "%d: suc: recv_from_uc from %d %p\n", node_id, from_id, c);
DEBUGF(3, "%d: suc: recv_from_uc from %d %p\n",
rimeaddr_node_addr.u16, from->u16, c);
if(c->u->recv != NULL) {
c->u->recv(c, from);
}
@ -75,7 +76,8 @@ send(void *ptr)
{
struct suc_conn *c = ptr;
DEBUGF(3, "%d: suc: resend to %d\n", node_id, c->receiver);
DEBUGF(3, "%d: suc: resend to %d\n",
rimeaddr_node_addr.u16, c->receiver.u16);
queuebuf_to_rimebuf(c->buf);
uc_send(&c->c, &c->receiver);
suc_set_timer(c, CLOCK_SECOND);
@ -103,7 +105,7 @@ suc_send_stubborn(struct suc_conn *c, rimeaddr_t *receiver)
rimeaddr_copy(&c->receiver, receiver);
ctimer_set(&c->t, CLOCK_SECOND, send, c);
DEBUGF(3, "%d: suc_send_stubborn to %d\n", node_id, c->receiver);
DEBUGF(3, "%d: suc_send_stubborn to %d\n", rimeaddr_node_addr.u16, c->receiver.u16);
uc_send(&c->c, &c->receiver);
if(c->u->sent != NULL) {
c->u->sent(c);
@ -114,7 +116,7 @@ suc_send_stubborn(struct suc_conn *c, rimeaddr_t *receiver)
}
/*---------------------------------------------------------------------------*/
int
suc_send_uc(struct suc_conn *c, rimeaddr_t *receiver)
suc_send(struct suc_conn *c, rimeaddr_t *receiver)
{
return uc_send(&c->c, receiver);
}

View File

@ -28,7 +28,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: suc.h,v 1.5 2007/03/19 22:10:17 adamdunkels Exp $
* $Id: suc.h,v 1.6 2007/03/20 12:27:32 adamdunkels Exp $
*/
/**
@ -67,7 +67,7 @@ void suc_close(struct suc_conn *c);
int suc_send_stubborn(struct suc_conn *c, rimeaddr_t *receiver);
void suc_cancel(struct suc_conn *c);
int suc_send_uc(struct suc_conn *c, rimeaddr_t *receiver);
int suc_send(struct suc_conn *c, rimeaddr_t *receiver);
void suc_set_timer(struct suc_conn *c, clock_time_t t);