00053 {
00054 if (msg->isSelfMessage())
00055 {
00056 bytesSent += msg->byteLength();
00057 send(msg, "tcpOut");
00058 }
00059 else if (msg->kind()==TCP_I_PEER_CLOSED)
00060 {
00061
00062 msg->setKind(TCP_C_CLOSE);
00063 sendOrSchedule(msg);
00064 }
00065 else if (msg->kind()==TCP_I_DATA || msg->kind()==TCP_I_URGENT_DATA)
00066 {
00067 bytesRcvd += msg->byteLength();
00068 if (echoFactor==0)
00069 {
00070 delete msg;
00071 }
00072 else
00073 {
00074
00075 msg->setKind(TCP_C_SEND);
00076 TCPCommand *ind = check_and_cast<TCPCommand *>(msg->removeControlInfo());
00077 TCPSendCommand *cmd = new TCPSendCommand();
00078 cmd->setConnId(ind->connId());
00079 msg->setControlInfo(cmd);
00080 delete ind;
00081
00082 long byteLen = msg->byteLength()*echoFactor;
00083 if (byteLen<1) byteLen=1;
00084 msg->setByteLength(byteLen);
00085
00086 sendOrSchedule(msg);
00087 }
00088 }
00089 else
00090 {
00091
00092 delete msg;
00093 }
00094
00095 if (ev.isGUI())
00096 {
00097 char buf[80];
00098 sprintf(buf, "rcvd: %ld bytes\nsent: %ld bytes", bytesRcvd, bytesSent);
00099 displayString().setTagArg("t",0,buf);
00100 }
00101 }