git-svn-id: svn://db.shs.com.ru/pip@408 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -62,6 +62,7 @@ void PIBaseTransfer::received(PIByteArray data) {
|
|||||||
data >> h;
|
data >> h;
|
||||||
PacketType pt = (PacketType)h.type;
|
PacketType pt = (PacketType)h.type;
|
||||||
if (!h.check_sig()) {
|
if (!h.check_sig()) {
|
||||||
|
piCoutObj << "invalid packet signature";
|
||||||
diag.received(data.size(), false);
|
diag.received(data.size(), false);
|
||||||
return;
|
return;
|
||||||
} else diag.received(data.size(), true);
|
} else diag.received(data.size(), true);
|
||||||
@@ -79,8 +80,8 @@ void PIBaseTransfer::received(PIByteArray data) {
|
|||||||
uint ccrc = crc.calculate(data.data(), data.size_s());
|
uint ccrc = crc.calculate(data.data(), data.size_s());
|
||||||
if (rcrc != ccrc) {
|
if (rcrc != ccrc) {
|
||||||
header.id = h.id;
|
header.id = h.id;
|
||||||
sendReply(pt_ReplyInvalid);
|
|
||||||
piCoutObj << "invalid CRC";
|
piCoutObj << "invalid CRC";
|
||||||
|
sendReply(pt_ReplyInvalid);
|
||||||
} else {
|
} else {
|
||||||
mutex_session.lock();
|
mutex_session.lock();
|
||||||
processData(h.id, data);
|
processData(h.id, data);
|
||||||
@@ -110,6 +111,8 @@ void PIBaseTransfer::received(PIByteArray data) {
|
|||||||
mutex_session.lock();
|
mutex_session.lock();
|
||||||
if (h.id < replies.size())
|
if (h.id < replies.size())
|
||||||
replies[h.id] = pt;
|
replies[h.id] = pt;
|
||||||
|
else
|
||||||
|
piCoutObj << "invalid reply id";
|
||||||
mutex_session.unlock();
|
mutex_session.unlock();
|
||||||
// piCoutObj << "Done Packet" << h.id;
|
// piCoutObj << "Done Packet" << h.id;
|
||||||
}
|
}
|
||||||
@@ -419,7 +422,7 @@ void PIBaseTransfer::sendBreak(int session_id) {
|
|||||||
|
|
||||||
|
|
||||||
void PIBaseTransfer::sendReply(PacketType reply) {
|
void PIBaseTransfer::sendReply(PacketType reply) {
|
||||||
//piCoutObj << "sendReply" << reply;
|
piCoutObj << "sendReply" << reply;
|
||||||
header.type = reply;
|
header.type = reply;
|
||||||
PIByteArray ba;
|
PIByteArray ba;
|
||||||
ba << header;
|
ba << header;
|
||||||
|
|||||||
Reference in New Issue
Block a user