Summary:
-- Made read buffering work (the buffer wasn't actually being used)
-- TServer now extends TRunnable (useful for testing)
-- Adding TLogging (the DEBUG and ERROR macros that we all know and love)
Reviewed By: Slee
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664824
13f79535-47bb-0310-9956-
ffa450edef68
#include <vector>
#include <exception>
+#include "TLogging.h"
+
namespace facebook { namespace thrift {
class Exception : public std::exception {
*
* @author Mark Slee <mcslee@facebook.com>
*/
-class TServer {
+class TServer : public concurrency::Runnable {
public:
virtual ~TServer() {}
virtual void serve() = 0;
+
+ // Allows running the server as a Runnable thread
+ virtual void run() { serve(); }
shared_ptr<TProcessor> getProcessor() {
return processor_;
buf += rLen_-rPos_;
}
// Get more from underlying transport up to buffer size
+ // TODO: should this be a readAll?
rLen_ = transport_->read(rBuf_, rBufSize_);
rPos_ = 0;
}
transport_->close();
}
- uint32_t readAll(uint8_t* buf, uint32_t len) {
- return transport_->readAll(buf, len);
- }
-
uint32_t read(uint8_t* buf, uint32_t len);
-
+
void write(const uint8_t* buf, uint32_t len);
void flush();
#ifndef _THRIFT_TRANSPORT_TTRANSPORT_H_
#define _THRIFT_TRANSPORT_TTRANSPORT_H_ 1
+#include "Thrift.h"
#include <transport/TTransportException.h>
#include <string>
}
have += get;
}
-
+
return have;
}