diff --git a/client.c b/client.c index 4efda05b..b709128d 100644 --- a/client.c +++ b/client.c @@ -53,10 +53,10 @@ int packetSendFollowup(struct in_addr destination, r=sendto(sock,packet,packet_len,0,(struct sockaddr *)&peer_addr,sizeof(peer_addr)); if (r(2048-128)) plen=-1; - if (debug&DEBUG_PACKETXFER) + if (debug&DEBUG_PACKETRX) serval_packetvisualise(stderr, "Read from dummy interface", &packet[128],plen); @@ -347,7 +347,7 @@ int overlay_rx_messages() c[i]=0; count--; } else { /* We have a frame from this interface */ - if (debug&DEBUG_PACKETXFER) + if (debug&DEBUG_PACKETRX) serval_packetvisualise(stderr,"Read from real interface", packet,plen); if (debug&DEBUG_OVERLAYINTERFACES)fprintf(stderr,"Received %d bytes on interface #%d (%s)\n",plen,i,overlay_interfaces[i].name); @@ -401,7 +401,7 @@ int overlay_broadcast_ensemble(int interface_number, else { s = overlay_interfaces[interface_number].broadcast_address; s.sin_family = AF_INET; - if (debug&DEBUG_PACKETXFER) fprintf(stderr,"Port=%d\n",overlay_interfaces[interface_number].port); + if (debug&DEBUG_PACKETTX) fprintf(stderr,"Port=%d\n",overlay_interfaces[interface_number].port); s.sin_port = htons( overlay_interfaces[interface_number].port ); } @@ -464,7 +464,7 @@ int overlay_broadcast_ensemble(int interface_number, interface they came in. */ int overlay_sendto(struct sockaddr_in *recipientaddr,unsigned char *bytes,int len) { - if (debug&DEBUG_PACKETXFER) fprintf(stderr,"Sending %d bytes.\n",len); + if (debug&DEBUG_PACKETTX) fprintf(stderr,"Sending %d bytes.\n",len); if(overlay_broadcast_ensemble(overlay_last_interface_number,recipientaddr,bytes,len)) return -1; else @@ -637,11 +637,14 @@ int overlay_stuff_packet_from_queue(int i,overlay_buffer *e,int q,long long now, WHY("bummer, I couldn't find an open route to that node"); } } else if (!(*p)->broadcast_sent_via[i]) - /* Broadcast frames are easy to work out if they go via this interface, - just make sure that they haven't been previously sent via this - interface. We then have some magic that only dequeues broadcast packets - once they have been sent via all open interfaces (or gone stale) */ - dontSend=0; + { + /* Broadcast frames are easy to work out if they go via this interface, + just make sure that they haven't been previously sent via this + interface. We then have some magic that only dequeues broadcast packets + once they have been sent via all open interfaces (or gone stale) */ + dontSend=0; + (*p)->broadcast_sent_via[i]=1; + } if (dontSend==0) { /* Try sending by this queue */ @@ -776,7 +779,9 @@ int overlay_tick_interface(int i, long long now) for(i=0;i0) - if (!(*p)->broadcast_sent_via[i]) { workLeft=1; break; } + if (!(*p)->broadcast_sent_via[i]) + { fprintf(stderr,"Frame still needs to be send on interface #%d\n",i); + workLeft=1; break; } } if (!workLeft) { WHY("Leaving broadcast payload on the queue for other interfaces"); diff --git a/peers.c b/peers.c index 822c020c..e3fed0c1 100644 --- a/peers.c +++ b/peers.c @@ -201,17 +201,17 @@ int sendToPeers(unsigned char *packet,int packet_len,int method,int peerId,struc { peer_addr.sin_addr=peers[i]; - if (debug&(DEBUG_PACKETXFER|DEBUG_PEERS)) fprintf(stderr,"Sending packet to peer #%d\n",i); + if (debug&(DEBUG_PACKETTX|DEBUG_PEERS)) fprintf(stderr,"Sending packet to peer #%d\n",i); ret=sendto(sock,packet,packet_len,0,(struct sockaddr *)&peer_addr,sizeof(peer_addr)); if (retcmsg_level == IPPROTO_IP) && ((cmsg->cmsg_type == IP_RECVTTL) ||(cmsg->cmsg_type == IP_TTL)) &&(cmsg->cmsg_len) ){ - if (debug&DEBUG_PACKETXFER) + if (debug&DEBUG_PACKETRX) fprintf(stderr," TTL (%p) data location resolves to %p\n", ttl,CMSG_DATA(cmsg)); if (CMSG_DATA(cmsg)) { *ttl = *(unsigned char *) CMSG_DATA(cmsg); - if (debug&DEBUG_PACKETXFER) + if (debug&DEBUG_PACKETRX) fprintf(stderr," TTL of packet is %d\n",*ttl); } } else { - if (debug&DEBUG_PACKETXFER) + if (debug&DEBUG_PACKETRX) fprintf(stderr,"I didn't expect to see level=%02x, type=%02x\n", cmsg->cmsg_level,cmsg->cmsg_type); } @@ -571,8 +571,8 @@ int simpleServerMode() client_addr=((struct sockaddr_in*)&recvaddr)->sin_addr; if (debug&DEBUG_DNAREQUESTS) fprintf(stderr,"Received packet from %s:%d (len=%d).\n",inet_ntoa(client_addr),client_port,len); - if (debug&DEBUG_PACKETXFER) dump("recvaddr",(unsigned char *)&recvaddr,recvaddrlen); - if (debug&DEBUG_PACKETXFER) dump("packet",(unsigned char *)buffer,len); + if (debug&DEBUG_PACKETRX) dump("recvaddr",(unsigned char *)&recvaddr,recvaddrlen); + if (debug&DEBUG_PACKETRX) dump("packet",(unsigned char *)buffer,len); if (dropPacketP(len)) { if (debug&DEBUG_SIMULATION) fprintf(stderr,"Simulation mode: Dropped packet due to simulated link parameters.\n"); continue; @@ -581,7 +581,7 @@ int simpleServerMode() if (packetOk(-1,buffer,len,NULL,ttl,&recvaddr,recvaddrlen,1)) { if (debug&DEBUG_PACKETFORMATS) setReason("Ignoring invalid packet"); } - if (debug&DEBUG_PACKETXFER) fprintf(stderr,"Finished processing packet, waiting for next one.\n"); + if (debug&DEBUG_PACKETRX) fprintf(stderr,"Finished processing packet, waiting for next one.\n"); } } return 0;