Update of /cvsroot/playerstage/code/player/server/drivers/shell
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26038/server/drivers/shell
Modified Files:
passthrough.cc
Log Message:
fixed server-server comms (again)
Index: passthrough.cc
===================================================================
RCS file: /cvsroot/playerstage/code/player/server/drivers/shell/passthrough.cc,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** passthrough.cc 18 Sep 2007 05:31:23 -0000 1.21
--- passthrough.cc 11 Dec 2007 01:58:01 -0000 1.22
***************
*** 220,224 ****
PLAYER_MSG0(9,"PassThrough::ProcessMessage: Received a packet!");
! if ( Device::MatchDeviceAddress(hdr->addr,srcAddr) && ( (hdr->type ==
PLAYER_MSGTYPE_DATA) || (hdr->type == PLAYER_MSGTYPE_RESP_ACK) || (hdr->type ==
PLAYER_MSGTYPE_SYNCH) || (hdr->type == PLAYER_MSGTYPE_RESP_NACK) ) ) {
PLAYER_MSG7(3,"PassThrough: Forwarding SRC->DST Interface code=%d
%d:%d:%d -> %d:%d:%d",hdr->addr.interf, hdr->addr.host,hdr->addr.robot,
hdr->addr.index, dstAddr.host, dstAddr.robot, dstAddr.index);
--- 220,229 ----
PLAYER_MSG0(9,"PassThrough::ProcessMessage: Received a packet!");
! if (Device::MatchDeviceAddress(hdr->addr,srcAddr) &&
! ((hdr->type == PLAYER_MSGTYPE_DATA) ||
! (hdr->type == PLAYER_MSGTYPE_RESP_ACK) ||
! (hdr->type == PLAYER_MSGTYPE_SYNCH) ||
! (hdr->type == PLAYER_MSGTYPE_RESP_NACK)))
! {
PLAYER_MSG7(3,"PassThrough: Forwarding SRC->DST Interface code=%d
%d:%d:%d -> %d:%d:%d",hdr->addr.interf, hdr->addr.host,hdr->addr.robot,
hdr->addr.index, dstAddr.host, dstAddr.robot, dstAddr.index);
***************
*** 229,233 ****
}
! if ( Device::MatchDeviceAddress(hdr->addr,dstAddr) && ( (hdr->type ==
PLAYER_MSGTYPE_CMD) || (hdr->type == PLAYER_MSGTYPE_REQ) ) ) {
PLAYER_MSG7(3,"PassThrough: Forwarding DST->SRC Interface code=%d
%d:%d:%d -> %d:%d:%d",hdr->addr.interf, hdr->addr.host,hdr->addr.robot,
hdr->addr.index, srcAddr.host, srcAddr.robot, srcAddr.index);
--- 234,240 ----
}
! if (Device::MatchDeviceAddress(hdr->addr,dstAddr) &&
! (hdr->type == PLAYER_MSGTYPE_CMD))
! {
PLAYER_MSG7(3,"PassThrough: Forwarding DST->SRC Interface code=%d
%d:%d:%d -> %d:%d:%d",hdr->addr.interf, hdr->addr.host,hdr->addr.robot,
hdr->addr.index, srcAddr.host, srcAddr.robot, srcAddr.index);
***************
*** 238,241 ****
--- 245,278 ----
inspected=true;
}
+ else if (Device::MatchDeviceAddress(hdr->addr,dstAddr) &&
+ (hdr->type == PLAYER_MSGTYPE_REQ))
+ {
+ // If it's a request, do it in-place and await the reply.
+
+ hdr->addr=srcAddr; //send to the device to which I subscribed, making
it seem like it comes from my original interface
+
+ Message* msg;
+ if(!(msg = srcDevice->Request(this->InQueue,
+ hdr->type,
+ hdr->subtype,
+ data, 0,
+ NULL, true)))
+ {
+ PLAYER_WARN("failed to forward request");
+ // Returning -1 here causes a NACK to be sent
+ return(-1);
+ }
+
+ // Got the response, so adjust the address and forward it
+ player_msghdr_t newhdr = *(msg->GetHeader());
+ newhdr.addr = dstAddr;
+ this->Publish(resp_queue,
+ &newhdr,
+ msg->GetPayload(),
+ false);
+ delete msg;
+ inspected=true;
+ }
+
//Check if a packet went thorugh, without being forwarded
-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit