|
@@ -437,16 +437,16 @@ struct sock_client:fd_io,client_ex
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- bool check_crc(const char*b,size_t mlen)
|
|
|
+ bool check_crc(void *b0,size_t mlen)
|
|
|
{
|
|
|
+ uint8_t*b=(uint8_t*)b0;
|
|
|
uint16_t crc=b[mlen-2];
|
|
|
crc<<=8;
|
|
|
crc|=b[mlen-1];
|
|
|
|
|
|
- if(do_crc((unsigned char*)b+2,mlen-4)==crc)
|
|
|
- return true;
|
|
|
+ uint16_t ccrc=do_crc((unsigned char*)b+2,mlen-4);
|
|
|
|
|
|
- return false;
|
|
|
+ return ccrc==crc;
|
|
|
}
|
|
|
|
|
|
void on_message(const char*m,int mlen)
|