summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/client
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2006-11-29 14:36:08 +0000
committerAlan Conway <aconway@apache.org>2006-11-29 14:36:08 +0000
commitb13e1a24fcca8797b7be5a242f164afbe17ec4f6 (patch)
treeef0362e52c125bc75b07ef3e374dabfa52254e98 /cpp/src/qpid/client
parent16d818e749462daf5e0e43079b2e48991646c619 (diff)
downloadqpid-python-b13e1a24fcca8797b7be5a242f164afbe17ec4f6.tar.gz
Posix EventChannel implementation using epoll. Placeholder for kevents.
Dynamic thread pool EventChannelThreads to serve EventChannel. Misc cleanup/enhancements. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@480582 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/client')
-rw-r--r--cpp/src/qpid/client/Connection.cpp2
-rw-r--r--cpp/src/qpid/client/Connector.cpp17
2 files changed, 11 insertions, 8 deletions
diff --git a/cpp/src/qpid/client/Connection.cpp b/cpp/src/qpid/client/Connection.cpp
index de324fdab4..0b520d169d 100644
--- a/cpp/src/qpid/client/Connection.cpp
+++ b/cpp/src/qpid/client/Connection.cpp
@@ -216,7 +216,7 @@ void Connection::error(int code, const string& msg, int classid, int methodid){
}
void Connection::channelException(Channel* channel, AMQMethodBody* method, QpidError& e){
- std::cout << "Caught error from channel [" << e.code << "] " << e.msg << " (" << e.file << ":" << e.line << ")" << std::endl;
+ std::cout << "Caught error from channel [" << e.code << "] " << e.msg << " (" << e.location.file << ":" << e.location.line << ")" << std::endl;
int code = e.code == PROTOCOL_ERROR ? e.code - PROTOCOL_ERROR : 500;
string msg = e.msg;
if(method == 0){
diff --git a/cpp/src/qpid/client/Connector.cpp b/cpp/src/qpid/client/Connector.cpp
index 86fbdc062c..116ea74193 100644
--- a/cpp/src/qpid/client/Connector.cpp
+++ b/cpp/src/qpid/client/Connector.cpp
@@ -44,6 +44,7 @@ Connector::Connector(bool _debug, u_int32_t buffer_size) :
Connector::~Connector(){ }
void Connector::connect(const std::string& host, int port){
+ socket = Socket::createTcp();
socket.connect(host, port);
closed = false;
receiver = Thread(this);
@@ -92,7 +93,7 @@ void Connector::writeToSocket(char* data, size_t available){
while(written < available && !closed){
ssize_t sent = socket.send(data + written, available-written);
if(sent > 0) {
- lastOut = Time::now().msecs();
+ lastOut = now() * TIME_MSEC;
written += sent;
}
}
@@ -106,17 +107,17 @@ void Connector::handleClosed(){
void Connector::checkIdle(ssize_t status){
if(timeoutHandler){
- int64_t now = Time::now().msecs();
+ Time t = now() * TIME_MSEC;
if(status == Socket::SOCKET_TIMEOUT) {
- if(idleIn && (now - lastIn > idleIn)){
+ if(idleIn && (t - lastIn > idleIn)){
timeoutHandler->idleIn();
}
}else if(status == Socket::SOCKET_EOF){
handleClosed();
}else{
- lastIn = now;
+ lastIn = t;
}
- if(idleOut && (now - lastOut > idleOut)){
+ if(idleOut && (t - lastOut > idleOut)){
timeoutHandler->idleOut();
}
}
@@ -140,7 +141,7 @@ void Connector::setWriteTimeout(u_int16_t t){
}
void Connector::setSocketTimeout(){
- socket.setTimeout(timeout);
+ socket.setTimeout(timeout*TIME_MSEC);
}
void Connector::setTimeoutHandler(TimeoutHandler* handler){
@@ -171,7 +172,9 @@ void Connector::run(){
}
}
}catch(QpidError error){
- std::cout << "Error [" << error.code << "] " << error.msg << " (" << error.file << ":" << error.line << ")" << std::endl;
+ std::cout << "Error [" << error.code << "] " << error.msg
+ << " (" << error.location.file << ":" << error.location.line
+ << ")" << std::endl;
handleClosed();
}
}