X-Git-Url: http://xvm.mit.edu/gitweb/invirt/third/libt4.git/blobdiff_plain/d54215aea2a7321ab0f2dc7b0042fea2b7ff5df5..4e881433f37417ccbda89c09ffdf936855d462d4:/rpc/connection.h?ds=sidebyside diff --git a/rpc/connection.h b/rpc/connection.h index 87d17e4..8f7d494 100644 --- a/rpc/connection.h +++ b/rpc/connection.h @@ -21,24 +21,18 @@ class connection_delegate { class connection : private aio_callback, public enable_shared_from_this { public: - struct charbuf { - string buf; - size_t solong = 0; // number of bytes written or read so far - }; - - connection(connection_delegate *m1, socket_t && f1, int lossytest=0); + connection(connection_delegate * delegate, socket_t && f1, int lossytest=0); ~connection(); - int channo() { return fd_; } - bool isdead() { lock ml(m_); return dead_; } - void closeconn(); + bool isdead() { return dead_; } bool send(const string & b); - time_point create_time() const { return create_time_; } - static shared_ptr to_dst(const sockaddr_in &dst, connection_delegate *mgr, int lossy=0); + const time_point create_time = steady_clock::now(); + const file_t fd; + private: void write_cb(int s); void read_cb(int s); @@ -46,15 +40,17 @@ class connection : private aio_callback, public enable_shared_from_this create_time_; - int waiters_ = 0; int lossy_ = 0; @@ -63,10 +59,10 @@ class connection : private aio_callback, public enable_shared_from_this> conns_; };