Commit d694e5de authored by Michal 'vorner' Vaner's avatar Michal 'vorner' Vaner

Revert "[trac931] Use uint32_t for fixed-sized lengths"

This reverts commit 6342eda0.
parent 5d33e8c4
...@@ -79,11 +79,11 @@ public: ...@@ -79,11 +79,11 @@ public:
{} {}
void establish(const char& socket_file); void establish(const char& socket_file);
void disconnect(); void disconnect();
void writeData(const void* data, uint32_t datalen); void writeData(const void* data, size_t datalen);
uint32_t readDataLength(); size_t readDataLength();
// Blocking read. Will throw a SessionTimeout if the timeout value // Blocking read. Will throw a SessionTimeout if the timeout value
// (in seconds) is thrown. If timeout is 0 it will block forever // (in seconds) is thrown. If timeout is 0 it will block forever
void readData(void* data, uint32_t datalen); void readData(void* data, size_t datalen);
void startRead(boost::function<void()> user_handler); void startRead(boost::function<void()> user_handler);
void setTimeout(size_t seconds) { timeout_ = seconds; }; void setTimeout(size_t seconds) { timeout_ = seconds; };
size_t getTimeout() const { return timeout_; }; size_t getTimeout() const { return timeout_; };
...@@ -94,7 +94,7 @@ public: ...@@ -94,7 +94,7 @@ public:
private: private:
void internalRead(const asio::error_code& error, void internalRead(const asio::error_code& error,
uint32_t bytes_transferred); size_t bytes_transferred);
private: private:
io_service& io_service_; io_service& io_service_;
...@@ -136,7 +136,7 @@ SessionImpl::disconnect() { ...@@ -136,7 +136,7 @@ SessionImpl::disconnect() {
} }
void void
SessionImpl::writeData(const void* data, uint32_t datalen) { SessionImpl::writeData(const void* data, size_t datalen) {
try { try {
asio::write(socket_, asio::buffer(data, datalen)); asio::write(socket_, asio::buffer(data, datalen));
} catch (const asio::system_error& asio_ex) { } catch (const asio::system_error& asio_ex) {
...@@ -144,9 +144,9 @@ SessionImpl::writeData(const void* data, uint32_t datalen) { ...@@ -144,9 +144,9 @@ SessionImpl::writeData(const void* data, uint32_t datalen) {
} }
} }
uint32_t size_t
SessionImpl::readDataLength() { SessionImpl::readDataLength() {
uint32_t ret_len = data_length_; size_t ret_len = data_length_;
if (ret_len == 0) { if (ret_len == 0) {
readData(&data_length_, sizeof(data_length_)); readData(&data_length_, sizeof(data_length_));
...@@ -161,7 +161,7 @@ SessionImpl::readDataLength() { ...@@ -161,7 +161,7 @@ SessionImpl::readDataLength() {
} }
void void
SessionImpl::readData(void* data, uint32_t datalen) { SessionImpl::readData(void* data, size_t datalen) {
boost::optional<asio::error_code> read_result; boost::optional<asio::error_code> read_result;
boost::optional<asio::error_code> timer_result; boost::optional<asio::error_code> timer_result;
...@@ -227,7 +227,7 @@ SessionImpl::startRead(boost::function<void()> user_handler) { ...@@ -227,7 +227,7 @@ SessionImpl::startRead(boost::function<void()> user_handler) {
void void
SessionImpl::internalRead(const asio::error_code& error, SessionImpl::internalRead(const asio::error_code& error,
uint32_t bytes_transferred) size_t bytes_transferred)
{ {
if (!error) { if (!error) {
assert(bytes_transferred == sizeof(data_length_)); assert(bytes_transferred == sizeof(data_length_));
...@@ -349,7 +349,7 @@ bool ...@@ -349,7 +349,7 @@ bool
Session::recvmsg(ConstElementPtr& env, ConstElementPtr& msg, Session::recvmsg(ConstElementPtr& env, ConstElementPtr& msg,
bool nonblock, int seq) bool nonblock, int seq)
{ {
uint32_t length = impl_->readDataLength(); size_t length = impl_->readDataLength();
if (hasQueuedMsgs()) { if (hasQueuedMsgs()) {
ConstElementPtr q_el; ConstElementPtr q_el;
for (int i = 0; i < impl_->queue_->size(); i++) { for (int i = 0; i < impl_->queue_->size(); i++) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment