/[pengfork]/pengfork/src/p3/check.c
ViewVC logotype

Diff of /pengfork/src/p3/check.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by chupa, Fri Sep 6 23:03:55 2002 UTC revision 1.3 by chupa, Sat Sep 7 22:32:04 2002 UTC
# Line 64  p3_check_packet (header, data, data_size Line 64  p3_check_packet (header, data, data_size
64    
65    /* Check packet is 0x0d terminated */    /* Check packet is 0x0d terminated */
66    if (p[data_size] != P3_STOP)    if (p[data_size] != P3_STOP)
67      return 0;      {
68          debug(1,"P3 - Bad packet received:\n");
69          debug(1,"\tnot 0x0d terminated\n");
70          return 0;
71        }
72    
73    /* Check CRC */    /* Check CRC */
74    crc = htons (p3_crc16 ((char *) &header->size, data_size + 5));    crc = htons (p3_crc16 ((char *) &header->size, data_size + 5));
75    if (crc != header->checksum)    if (crc != header->checksum)
76      return 0;      {
77          debug(1,"P3 - Bad packet received:\n");
78          debug(1,"\tbad CRC checksum\n");
79          return 0;
80        }
81    
82    /* So it seems to be a valid packet */    /* So it seems to be a valid packet */
83    
# Line 81  p3_check_ordering (header) Line 89  p3_check_ordering (header)
89       struct p3hdr *header;       struct p3hdr *header;
90  {  {
91    if (header->type == TYPE_DATA && header->seq != p3_next_seq (srv.lastseq))    if (header->type == TYPE_DATA && header->seq != p3_next_seq (srv.lastseq))
92      /* packet is data and the seq isn't what we are waiting for */      {
93      return 0;        debug (1, "P3 - Bad ordering for data packet received\n");
94    if (header->type != TYPE_DATA && header->seq != srv.lastseq)        debug (1, "\tseq received: %d\n", header->seq);
95      /* packet is not data and the seq has changed */        debug (1, "\tseq expected: %d\n", p3_next_seq (srv.lastseq));
96      return 0;        /* packet is data and the seq isn't what we expect */
97          return 0;
98        }
99      /*if (header->type != TYPE_DATA && header->seq != srv.lastseq)
100        {
101          debug (1, "P3 - Bad ordering for packet received\n");
102          debug (1, "\tseq received: %d\n", header->seq);
103          debug (1, "\tseq expected: %d\n", srv.lastseq);
104          /* packet is not data and the seq has changed */
105      /*return 0;
106        }*/
107    
108    return 1;    return 1;
109  }  }

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26