Revision: 6981 http://playerstage.svn.sourceforge.net/playerstage/?rev=6981&view=rev Author: thjc Date: 2008-08-25 21:20:43 +0000 (Mon, 25 Aug 2008)
Log Message: ----------- disabled very verbose debug messages in passthrough, dont think you would ever need it this verbose except while debugging passthrough (when they could be compiled back in) Modified Paths: -------------- code/player/branches/release-2-1-patches/server/drivers/shell/passthrough.cc Modified: code/player/branches/release-2-1-patches/server/drivers/shell/passthrough.cc =================================================================== --- code/player/branches/release-2-1-patches/server/drivers/shell/passthrough.cc 2008-08-25 21:17:48 UTC (rev 6980) +++ code/player/branches/release-2-1-patches/server/drivers/shell/passthrough.cc 2008-08-25 21:20:43 UTC (rev 6981) @@ -124,7 +124,7 @@ int ConnectRemote(); int DisconnectRemote(); - + virtual int ProcessMessage(QueuePointer &resp_queue, player_msghdr * hdr, void * data); private: @@ -136,16 +136,16 @@ player_devaddr_t srcAddr; //the device that this server connects to to get data Device *srcDevice; - + // properties StringProperty RemoteHost; IntProperty RemotePort; IntProperty RemoteIndex; - + IntProperty Connect; int Connected; - + }; Driver* @@ -206,7 +206,7 @@ int ret = ConnectRemote(); if (ret) return ret; - + } StartThread(); @@ -222,7 +222,7 @@ StopThread(); DisconnectRemote(); - + PLAYER_MSG0(1,"PassThrough driver has been shutdown"); return(0); @@ -232,7 +232,7 @@ { if (Connected) return 0; - + if (RemoteHost.GetValue()[0] != '\0') { PLAYER_MSG1(3,"Overriding remote hostname to %s", RemoteHost.GetValue()); @@ -275,7 +275,7 @@ return 0; //Our clients disconnected, so let's disconnect from our SRC interface srcDevice->Unsubscribe(this->InQueue); - + Connected = 0; return 0; } @@ -289,19 +289,19 @@ bool inspected(false); // let our properties through - if (Message::MatchMessage(hdr, PLAYER_MSGTYPE_REQ, PLAYER_SET_STRPROP_REQ)) + if (Message::MatchMessage(hdr, PLAYER_MSGTYPE_REQ, PLAYER_SET_STRPROP_REQ)) { player_strprop_req_t req = *reinterpret_cast<player_strprop_req_t*> (data); - if (strcmp("remote_host", req.key) == 0) + if (strcmp("remote_host", req.key) == 0) return -1; } - - if (Message::MatchMessage(hdr, PLAYER_MSGTYPE_REQ, PLAYER_SET_INTPROP_REQ)) + + if (Message::MatchMessage(hdr, PLAYER_MSGTYPE_REQ, PLAYER_SET_INTPROP_REQ)) { player_intprop_req_t req = *reinterpret_cast<player_intprop_req_t*> (data); - if (strcmp("remote_port", req.key) == 0) + if (strcmp("remote_port", req.key) == 0) return -1; - if (strcmp("remote_index", req.key) == 0) + if (strcmp("remote_index", req.key) == 0) return -1; if (strcmp("connect", req.key) == 0) { @@ -318,11 +318,11 @@ DisconnectRemote(); ConnectRemote(); } - + return -1; } } - + // silence warning etc while we are not connected if (!Connected) { @@ -332,17 +332,17 @@ } return 0; } - + 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))) + + 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(8,"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); + //PLAYER_MSG7(8,"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); hdr->addr=dstAddr; //will send to my clients, making it seem like it comes from my DST interface @@ -350,10 +350,10 @@ inspected=true; } - if (Device::MatchDeviceAddress(hdr->addr,dstAddr) && + if (Device::MatchDeviceAddress(hdr->addr,dstAddr) && (hdr->type == PLAYER_MSGTYPE_CMD)) { - PLAYER_MSG7(8,"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); + //PLAYER_MSG7(8,"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); hdr->addr=srcAddr; //send to the device to which I subscribed, making it seem like it comes from my original interface @@ -361,7 +361,7 @@ srcDevice->PutMsg(this->InQueue,hdr,data); //putMsg is the correct way to talk to this subscribed device, any answer comes to the queue of this driver inspected=true; } - else if (Device::MatchDeviceAddress(hdr->addr,dstAddr) && + 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. @@ -383,7 +383,7 @@ // Got the response, so adjust the address and forward it player_msghdr_t newhdr = *(msg->GetHeader()); newhdr.addr = dstAddr; - this->Publish(resp_queue, + this->Publish(resp_queue, &newhdr, msg->GetPayload()); delete msg; @@ -410,7 +410,7 @@ void PassThrough::Main() { //The forwarding is done in the ProcessMessage method. Called once per each message by ProcessMessages() - while (true) + while (true) { InQueue->Wait(); ProcessMessages(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Playerstage-commit mailing list Playerstage-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/playerstage-commit