[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: question about webtraf.*
It's been fixed in the daily snapshot. Or you can apply the enclosed
patch. Thanks for reporting the problem.
- Haobo
Index: webtraf.h
===================================================================
RCS file: /usr/src/mash/repository/vint/ns-2/webcache/webtraf.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- webtraf.h 1999/09/26 21:26:11 1.2
+++ webtraf.h 1999/11/18 22:31:29 1.3
@@ -30,7 +30,7 @@
// only interested in traffic pattern here, we do not want to be bothered
// with the burden of transmitting HTTP headers, etc.
//
-// $Header: /usr/src/mash/repository/vint/ns-2/webcache/webtraf.h,v 1.2 1999/09/26 21:26:11 haoboy Exp $
+// $Header: /usr/src/mash/repository/vint/ns-2/webcache/webtraf.h,v 1.3 1999/11/18 22:31:29 haoboy Exp $
#ifndef ns_webtraf_h
#define ns_webtraf_h
@@ -64,8 +64,8 @@
RandomVariable*& interObj() { return rvInterObj_; }
RandomVariable*& objSize() { return rvObjSize_; }
- void donePage(int id, void* ClntData);
- void launchReq(int page, int obj, int size);
+ void donePage(void* ClntData);
+ void launchReq(void* ClntData, int obj, int size);
static int LASTPAGE_;
Index: webtraf.cc
===================================================================
RCS file: /usr/src/mash/repository/vint/ns-2/webcache/webtraf.cc,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- webtraf.cc 1999/10/11 23:31:59 1.2
+++ webtraf.cc 1999/11/18 22:31:29 1.3
@@ -26,7 +26,7 @@
//
// Incorporation Polly's web traffic module into the PagePool framework
//
-// $Header: /usr/src/mash/repository/vint/ns-2/webcache/webtraf.cc,v 1.2 1999/10/11 23:31:59 haoboy Exp $
+// $Header: /usr/src/mash/repository/vint/ns-2/webcache/webtraf.cc,v 1.3 1999/11/18 22:31:29 haoboy Exp $
#include <tclcl.h>
@@ -42,18 +42,20 @@
class WebPage : public TimerHandler {
public:
- WebPage(int id, WebTrafSession* sess, int nObj) :
- id_(id), sess_(sess), nObj_(nObj), curObj_(0) {}
+ WebPage(int id, WebTrafSession* sess, int nObj, Node* dst) :
+ id_(id), sess_(sess), nObj_(nObj), curObj_(0), dst_(dst) {}
virtual ~WebPage() {}
void start() {
expire();
schedNext();
}
+ Node* dst() { return dst_; }
+
private:
virtual void expire(Event* = 0) {
// Launch a request. Make sure size is not 0!
- sess_->launchReq(id_, LASTOBJ_++,
+ sess_->launchReq(this, LASTOBJ_++,
(int)ceil(sess_->objSize()->value()));
}
virtual void handle(Event *e) {
@@ -64,7 +66,7 @@
// Schedule next timer
if (++curObj_ >= nObj_) {
// We are done with this page, tell parent to delete me
- sess_->donePage(id_, (void*)this);
+ sess_->donePage((void*)this);
return;
}
sched(sess_->interObj()->value());
@@ -72,6 +74,7 @@
int id_;
WebTrafSession* sess_;
int nObj_, curObj_;
+ Node* dst_;
static int LASTOBJ_;
};
@@ -95,7 +98,7 @@
Tcl::instance().evalf("delete %s", rvObjSize_->name());
}
-void WebTrafSession::donePage(int /*id*/, void* ClntData)
+void WebTrafSession::donePage(void* ClntData)
{
donePage_++;
delete (WebPage*)ClntData;
@@ -104,9 +107,11 @@
// Launch the current page
void WebTrafSession::expire(Event *)
{
- // Mke sure page size is not 0!
+ // Pick destination for this page
+ Node* dst = mgr_->pickdst();
+ // Make sure page size is not 0!
WebPage* pg = new WebPage(LASTPAGE_++, this,
- (int)ceil(rvPageSize_->value()));
+ (int)ceil(rvPageSize_->value()), dst);
pg->start();
}
@@ -125,10 +130,10 @@
}
// Launch a request for a particular object
-void WebTrafSession::launchReq(int /*page*/, int obj, int size)
+void WebTrafSession::launchReq(void* ClntData, int obj, int size)
{
- // Pick destination
- Node* dst = mgr_->pickdst();
+ WebPage* pg = (WebPage*)ClntData;
+
// Choose source and dest TCP agents for both source and destination
TcpAgent* ctcp = mgr_->picktcp();
TcpAgent* stcp = mgr_->picktcp();
@@ -137,7 +142,8 @@
// Setup TCP connection and done
Tcl::instance().evalf("%s launch-req %d %s %s %s %s %s %s %d",
- mgr_->name(), obj, src_->name(), dst->name(),
+ mgr_->name(), obj, src_->name(),
+ pg->dst()->name(),
ctcp->name(), csnk->name(), stcp->name(),
ssnk->name(), size);
// Debug only