Revision: 8744
http://playerstage.svn.sourceforge.net/playerstage/?rev=8744&view=rev
Author: gbiggs
Date: 2010-06-02 06:59:48 +0000 (Wed, 02 Jun 2010)
Log Message:
-----------
Applied patch #2997935: zero sized requests once again
Modified Paths:
--------------
code/player/trunk/server/drivers/position/globalize/globalize.cc
code/player/trunk/server/drivers/shell/cmdsplitter.cc
code/player/trunk/server/drivers/shell/inhibitor.cc
code/player/trunk/server/drivers/shell/suppressor.cc
Modified: code/player/trunk/server/drivers/position/globalize/globalize.cc
===================================================================
--- code/player/trunk/server/drivers/position/globalize/globalize.cc
2010-06-02 06:57:33 UTC (rev 8743)
+++ code/player/trunk/server/drivers/position/globalize/globalize.cc
2010-06-02 06:59:48 UTC (rev 8744)
@@ -93,6 +93,7 @@
player_msghdr_t rq_hdrs[RQ_QUEUE_LEN];
QueuePointer rq_ptrs[RQ_QUEUE_LEN];
void * payloads[RQ_QUEUE_LEN];
+ int rq[RQ_QUEUE_LEN];
int last_rq;
double cmd_interval;
double cmd_time;
@@ -112,6 +113,7 @@
for (i = 0; i < RQ_QUEUE_LEN; i++)
{
this->payloads[i] = NULL;
+ this->rq[i] = 0;
}
this->last_rq = -1;
this->cmd_interval = 0.0;
@@ -166,6 +168,7 @@
for (i = 0; i < RQ_QUEUE_LEN; i++)
{
this->payloads[i] = NULL;
+ this->rq[i] = 0;
}
this->last_rq = -1;
if ((Device::MatchDeviceAddress(this->r_local_pos_addr, this->p_pos_addr))
@@ -213,10 +216,14 @@
this->r_local_pos_dev = NULL;
if (this->r_global_pos_dev)
this->r_global_pos_dev->Unsubscribe(this->InQueue);
this->r_global_pos_dev = NULL;
- for (i = 0; i < RQ_QUEUE_LEN; i++) if (this->payloads[i])
+ for (i = 0; i < RQ_QUEUE_LEN; i++)
{
- free(this->payloads[i]);
- this->payloads[i] = NULL;
+ if (this->payloads[i])
+ {
+ free(this->payloads[i]);
+ this->payloads[i] = NULL;
+ }
+ this->rq[i] = 0;
}
return 0;
}
@@ -255,24 +262,28 @@
}
if (Message::MatchMessage(hdr, PLAYER_MSGTYPE_REQ, -1, this->p_pos_addr))
{
- for (i = 0; i < RQ_QUEUE_LEN; i++) if (!(this->payloads[i]))
+ for (i = 0; i < RQ_QUEUE_LEN; i++) if (!(this->rq[i]))
{
this->rq_hdrs[i] = *hdr;
this->rq_ptrs[i] = resp_queue;
- this->payloads[i] = malloc(hdr->size);
- assert(this->payloads[i]);
- memcpy(this->payloads[i], data, hdr->size);
+ if ((hdr->size) > 0)
+ {
+ this->payloads[i] = malloc(hdr->size);
+ assert(this->payloads[i]);
+ memcpy(this->payloads[i], data, hdr->size);
+ } else (this->payloads[i]) = NULL;
+ this->rq[i] = !0;
break;
}
if (!(i < RQ_QUEUE_LEN)) return -1;
n = -1;
- for (i = 0; i < RQ_QUEUE_LEN; i++) if (this->payloads[i]) n = i;
+ for (i = 0; i < RQ_QUEUE_LEN; i++) if (this->rq[i]) n = i;
assert(n >= 0);
if (!n)
{
newhdr = this->rq_hdrs[n];
newhdr.addr = this->r_local_pos_addr;
- assert(this->payloads[n]);
+ if ((newhdr.size) > 0) assert(this->payloads[n]);
this->r_local_pos_dev->PutMsg(this->InQueue, &newhdr, this->payloads[n],
true); // copy = true
this->last_rq = n;
}
@@ -288,15 +299,20 @@
assert((hdr->subtype) == (this->rq_hdrs[this->last_rq].subtype));
this->Publish(this->p_pos_addr, this->rq_ptrs[this->last_rq], hdr->type,
hdr->subtype, data, 0, &(hdr->timestamp), true); // copy = true
this->rq_ptrs[this->last_rq] = null;
- assert(this->payloads[this->last_rq]);
- free(this->payloads[this->last_rq]);
+ assert(this->rq[this->last_rq]);
+ if (this->payloads[this->last_rq])
+ {
+ assert(this->payloads[this->last_rq]);
+ free(this->payloads[this->last_rq]);
+ }
this->payloads[this->last_rq] = NULL;
+ this->rq[this->last_rq] = 0;
this->last_rq = -1;
- for (i = 0; i < RQ_QUEUE_LEN; i++) if (this->payloads[i])
+ for (i = 0; i < RQ_QUEUE_LEN; i++) if (this->rq[i])
{
newhdr = this->rq_hdrs[i];
newhdr.addr = this->r_local_pos_addr;
- assert(this->payloads[i]);
+ if ((newhdr.size) > 0) assert(this->payloads[i]);
this->r_local_pos_dev->PutMsg(this->InQueue, &newhdr, this->payloads[i],
true); // copy = true;
this->last_rq = i;
break;
Modified: code/player/trunk/server/drivers/shell/cmdsplitter.cc
===================================================================
--- code/player/trunk/server/drivers/shell/cmdsplitter.cc 2010-06-02
06:57:33 UTC (rev 8743)
+++ code/player/trunk/server/drivers/shell/cmdsplitter.cc 2010-06-02
06:59:48 UTC (rev 8744)
@@ -212,10 +212,13 @@
if (this->required_devs[i])
this->required_devs[i]->Unsubscribe(this->InQueue);
this->required_devs[i] = NULL;
}
- for (i = 0; i < RQ_QUEUE_LEN; i++) if (this->payloads[i])
+ for (i = 0; i < RQ_QUEUE_LEN; i++)
{
- free(this->payloads[i]);
- this->payloads[i] = NULL;
+ if (this->payloads[i])
+ {
+ free(this->payloads[i]);
+ this->payloads[i] = NULL;
+ }
this->rq[i] = 0;
}
return 0;
Modified: code/player/trunk/server/drivers/shell/inhibitor.cc
===================================================================
--- code/player/trunk/server/drivers/shell/inhibitor.cc 2010-06-02 06:57:33 UTC
(rev 8743)
+++ code/player/trunk/server/drivers/shell/inhibitor.cc 2010-06-02 06:59:48 UTC
(rev 8744)
@@ -125,6 +125,7 @@
private: double msg_interval;
private: double lastTime;
private: int switch_state;
+ private: int rq[RQ_QUEUE_LEN];
private: int last_rq;
private: player_msghdr_t rq_hdrs[RQ_QUEUE_LEN];
private: QueuePointer rq_ptrs[RQ_QUEUE_LEN];
@@ -156,6 +157,7 @@
for (i = 0; i < RQ_QUEUE_LEN; i++)
{
this->payloads[i] = NULL;
+ this->rq[i] = 0;
}
if (cf->ReadDeviceAddr(&(this->dio_provided_addr), section, "provides",
PLAYER_DIO_CODE, -1, "switch"))
{
@@ -260,6 +262,7 @@
for (i = 0; i < RQ_QUEUE_LEN; i++)
{
this->payloads[i] = NULL;
+ this->rq[i] = 0;
}
if (Device::MatchDeviceAddress(this->comm_required_addr,
this->comm_provided_addr))
{
@@ -320,10 +323,14 @@
this->comm_required_dev = NULL;
if (this->dio_required_dev)
this->dio_required_dev->Unsubscribe(this->InQueue);
this->dio_required_dev = NULL;
- for (i = 0; i < RQ_QUEUE_LEN; i++) if (this->payloads[i])
+ for (i = 0; i < RQ_QUEUE_LEN; i++)
{
- free(this->payloads[i]);
- this->payloads[i] = NULL;
+ if (this->payloads[i])
+ {
+ free(this->payloads[i]);
+ this->payloads[i] = NULL;
+ }
+ this->rq[i] = 0;
}
return 0;
}
@@ -410,24 +417,28 @@
}
if (Message::MatchMessage(hdr, PLAYER_MSGTYPE_REQ, -1,
this->comm_provided_addr))
{
- for (i = 0; i < RQ_QUEUE_LEN; i++) if (!(this->payloads[i]))
+ for (i = 0; i < RQ_QUEUE_LEN; i++) if (!(this->rq[i]))
{
this->rq_hdrs[i] = *hdr;
this->rq_ptrs[i] = resp_queue;
- this->payloads[i] = malloc(hdr->size);
- assert(this->payloads[i]);
- memcpy(this->payloads[i], data, hdr->size);
+ if ((hdr->size) > 0)
+ {
+ this->payloads[i] = malloc(hdr->size);
+ assert(this->payloads[i]);
+ memcpy(this->payloads[i], data, hdr->size);
+ } else this->payloads[i] = NULL;
+ this->rq[i] = !0;
break;
}
if (!(i < RQ_QUEUE_LEN)) return -1;
n = -1;
- for (i = 0; i < RQ_QUEUE_LEN; i++) if (this->payloads[i]) n = i;
+ for (i = 0; i < RQ_QUEUE_LEN; i++) if (this->rq[i]) n = i;
assert(n >= 0);
if (!n)
{
newhdr = this->rq_hdrs[n];
newhdr.addr = this->comm_required_addr;
- assert(this->payloads[n]);
+ if ((newhdr.size) > 0) assert(this->payloads[n]);
this->comm_required_dev->PutMsg(this->InQueue, &newhdr,
this->payloads[n], true); // copy = true
this->last_rq = n;
}
@@ -447,15 +458,20 @@
}
this->Publish(this->comm_provided_addr, this->rq_ptrs[this->last_rq],
hdr->type, hdr->subtype, data, 0, &(hdr->timestamp), true); // copy = true
this->rq_ptrs[this->last_rq] = null;
- assert(this->payloads[this->last_rq]);
- free(this->payloads[this->last_rq]);
+ assert(this->rq[this->last_rq]);
+ if (this->payloads[this->last_rq])
+ {
+ assert(this->payloads[this->last_rq]);
+ free(this->payloads[this->last_rq]);
+ }
this->payloads[this->last_rq] = NULL;
+ this->rq[this->last_rq] = 0;
this->last_rq = -1;
- for (i = 0; i < RQ_QUEUE_LEN; i++) if (this->payloads[i])
+ for (i = 0; i < RQ_QUEUE_LEN; i++) if (this->rq[i])
{
newhdr = this->rq_hdrs[i];
newhdr.addr = this->comm_required_addr;
- assert(this->payloads[i]);
+ if ((newhdr.size) > 0) assert(this->payloads[i]);
this->comm_required_dev->PutMsg(this->InQueue, &newhdr,
this->payloads[i], true); // copy = true;
this->last_rq = i;
break;
Modified: code/player/trunk/server/drivers/shell/suppressor.cc
===================================================================
--- code/player/trunk/server/drivers/shell/suppressor.cc 2010-06-02
06:57:33 UTC (rev 8743)
+++ code/player/trunk/server/drivers/shell/suppressor.cc 2010-06-02
06:59:48 UTC (rev 8744)
@@ -102,6 +102,7 @@
private: double fadeout_time;
private: double fadeout_start;
private: int fading_out;
+ private: int rq[RQ_QUEUE_LEN];
private: int last_rq;
private: player_msghdr_t rq_hdrs[RQ_QUEUE_LEN];
private: QueuePointer rq_ptrs[RQ_QUEUE_LEN];
@@ -124,6 +125,7 @@
for (i = 0; i < RQ_QUEUE_LEN; i++)
{
this->payloads[i] = NULL;
+ this->rq[i] = 0;
}
if (cf->ReadDeviceAddr(&(this->master_provided_addr), section, "provides",
-1, -1, "master"))
{
@@ -160,7 +162,7 @@
{
PLAYER_ERROR("Invalid fadeout_time value");
this->SetError(-1);
- return;
+ return;
}
}
@@ -186,6 +188,7 @@
for (i = 0; i < RQ_QUEUE_LEN; i++)
{
this->payloads[i] = NULL;
+ this->rq[i] = 0;
}
if (Device::MatchDeviceAddress(this->required_addr,
this->master_provided_addr))
{
@@ -213,10 +216,14 @@
if (this->required_dev) this->required_dev->Unsubscribe(this->InQueue);
this->required_dev = NULL;
- for (i = 0; i < RQ_QUEUE_LEN; i++) if (this->payloads[i])
+ for (i = 0; i < RQ_QUEUE_LEN; i++)
{
- free(this->payloads[i]);
- this->payloads[i] = NULL;
+ if (this->payloads[i])
+ {
+ free(this->payloads[i]);
+ this->payloads[i] = NULL;
+ }
+ this->rq[i] = 0;
}
return 0;
}
@@ -269,24 +276,28 @@
}
if ((Message::MatchMessage(hdr, PLAYER_MSGTYPE_REQ, -1,
this->master_provided_addr)) || (Message::MatchMessage(hdr, PLAYER_MSGTYPE_REQ,
-1, this->slave_provided_addr)))
{
- for (i = 0; i < RQ_QUEUE_LEN; i++) if (!(this->payloads[i]))
+ for (i = 0; i < RQ_QUEUE_LEN; i++) if (!(this->rq[i]))
{
this->rq_hdrs[i] = *hdr;
this->rq_ptrs[i] = resp_queue;
- this->payloads[i] = malloc(hdr->size);
- assert(this->payloads[i]);
- memcpy(this->payloads[i], data, hdr->size);
+ if ((hdr->size) > 0)
+ {
+ this->payloads[i] = malloc(hdr->size);
+ assert(this->payloads[i]);
+ memcpy(this->payloads[i], data, hdr->size);
+ } else (this->payloads[i]) = NULL;
+ this->rq[i] = !0;
break;
}
if (!(i < RQ_QUEUE_LEN)) return -1;
n = -1;
- for (i = 0; i < RQ_QUEUE_LEN; i++) if (this->payloads[i]) n = i;
+ for (i = 0; i < RQ_QUEUE_LEN; i++) if (this->rq[i]) n = i;
assert(n >= 0);
if (!n)
{
newhdr = this->rq_hdrs[n];
newhdr.addr = this->required_addr;
- assert(this->payloads[n]);
+ if ((newhdr.size) > 0) assert(this->payloads[n]);
this->required_dev->PutMsg(this->InQueue, &newhdr, this->payloads[n],
true); // copy = true
this->last_rq = n;
}
@@ -306,15 +317,20 @@
}
this->Publish(this->rq_hdrs[this->last_rq].addr,
this->rq_ptrs[this->last_rq], hdr->type, hdr->subtype, data, 0,
&(hdr->timestamp), true); // copy = true
this->rq_ptrs[this->last_rq] = null;
- assert(this->payloads[this->last_rq]);
- free(this->payloads[this->last_rq]);
+ assert(this->rq[this->last_rq]);
+ if (this->payloads[this->last_rq])
+ {
+ assert(this->payloads[this->last_rq]);
+ free(this->payloads[this->last_rq]);
+ }
this->payloads[this->last_rq] = NULL;
+ this->rq[this->last_rq] = 0;
this->last_rq = -1;
- for (i = 0; i < RQ_QUEUE_LEN; i++) if (this->payloads[i])
+ for (i = 0; i < RQ_QUEUE_LEN; i++) if (this->rq[i])
{
newhdr = this->rq_hdrs[i];
newhdr.addr = this->required_addr;
- assert(this->payloads[i]);
+ if ((newhdr.size) > 0) assert(this->payloads[i]);
this->required_dev->PutMsg(this->InQueue, &newhdr, this->payloads[i],
true); // copy = true;
this->last_rq = i;
break;
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit