[svn] commit: r3379 - in /branches/trac394/src/lib/asiolink: internal/tcpdns.h internal/udpdns.h tcpdns.cc udpdns.cc
BIND 10 source code commits
bind10-changes at lists.isc.org
Wed Oct 27 15:36:24 UTC 2010
Author: jelte
Date: Wed Oct 27 15:36:24 2010
New Revision: 3379
Log:
another shared_ptr vs shared_array i missed in the previous commit
also reverted the peer/iosocket code as explained in http://bind10.isc.org/ticket/394?replyto=3#comment:3
Modified:
branches/trac394/src/lib/asiolink/internal/tcpdns.h
branches/trac394/src/lib/asiolink/internal/udpdns.h
branches/trac394/src/lib/asiolink/tcpdns.cc
branches/trac394/src/lib/asiolink/udpdns.cc
Modified: branches/trac394/src/lib/asiolink/internal/tcpdns.h
==============================================================================
--- branches/trac394/src/lib/asiolink/internal/tcpdns.h (original)
+++ branches/trac394/src/lib/asiolink/internal/tcpdns.h Wed Oct 27 15:36:24 2010
@@ -21,6 +21,7 @@
#include <asio.hpp>
+#include <boost/shared_array.hpp>
#include <boost/shared_ptr.hpp>
#include <dns/buffer.h>
@@ -167,7 +168,7 @@
isc::dns::MessagePtr message_;
// The buffer into which the query packet is written
- boost::shared_ptr<char> data_;
+ boost::shared_array<char>data_;
// State information that is entirely internal to a given instance
// of the coroutine can be declared here.
@@ -178,6 +179,9 @@
const SimpleCallback* checkin_callback_;
const DNSLookup* lookup_callback_;
const DNSAnswer* answer_callback_;
+
+ boost::shared_ptr<IOEndpoint> peer_;
+ boost::shared_ptr<IOSocket> iosock_;
};
}
Modified: branches/trac394/src/lib/asiolink/internal/udpdns.h
==============================================================================
--- branches/trac394/src/lib/asiolink/internal/udpdns.h (original)
+++ branches/trac394/src/lib/asiolink/internal/udpdns.h Wed Oct 27 15:36:24 2010
@@ -173,6 +173,9 @@
const SimpleCallback* checkin_callback_;
const DNSLookup* lookup_callback_;
const DNSAnswer* answer_callback_;
+
+ boost::shared_ptr<IOEndpoint> peer_;
+ boost::shared_ptr<IOSocket> iosock_;
};
//
Modified: branches/trac394/src/lib/asiolink/tcpdns.cc
==============================================================================
--- branches/trac394/src/lib/asiolink/tcpdns.cc (original)
+++ branches/trac394/src/lib/asiolink/tcpdns.cc Wed Oct 27 15:36:24 2010
@@ -73,8 +73,6 @@
/// permitted. Certain variables used below can be declared here.
boost::array<const_buffer,2> bufs;
OutputBuffer* lenbuf;
- IOEndpoint* peer;
- IOSocket* iosock;
CORO_REENTER (this) {
do {
@@ -96,7 +94,7 @@
/// Instantiate the data buffer that will be used by the
/// asynchronous read call.
- data_ = boost::shared_ptr<char>(new char[MAX_LENGTH]);
+ data_.reset(new char[MAX_LENGTH]);
/// Read the message, in two parts. First, the message length:
CORO_YIELD async_read(*socket_, asio::buffer(data_.get(),
@@ -122,9 +120,9 @@
// (XXX: It would be good to write a factory function
// that would quickly generate an IOMessage object without
// all these calls to "new".)
- peer = new TCPEndpoint(socket_->remote_endpoint());
- iosock = new TCPSocket(*socket_);
- io_message_.reset(new IOMessage(data_.get(), length, *iosock, *peer));
+ peer_.reset(new TCPEndpoint(socket_->remote_endpoint()));
+ iosock_.reset(new TCPSocket(*socket_));
+ io_message_.reset(new IOMessage(data_.get(), length, *iosock_, *peer_));
bytes_ = length;
// Perform any necessary operations prior to processing the incoming
Modified: branches/trac394/src/lib/asiolink/udpdns.cc
==============================================================================
--- branches/trac394/src/lib/asiolink/udpdns.cc (original)
+++ branches/trac394/src/lib/asiolink/udpdns.cc Wed Oct 27 15:36:24 2010
@@ -73,8 +73,6 @@
/// Because the coroutine reeentry block is implemented as
/// a switch statement, inline variable declarations are not
/// permitted. Certain variables used below can be declared here.
- IOEndpoint* peer;
- IOSocket* iosock;
CORO_REENTER (this) {
do {
@@ -106,9 +104,9 @@
// (XXX: It would be good to write a factory function
// that would quickly generate an IOMessage object without
// all these calls to "new".)
- peer = new UDPEndpoint(*sender_);
- iosock = new UDPSocket(*socket_);
- io_message_.reset(new IOMessage(data_.get(), bytes_, *iosock, *peer));
+ peer_.reset(new UDPEndpoint(*sender_));
+ iosock_.reset(new UDPSocket(*socket_));
+ io_message_.reset(new IOMessage(data_.get(), bytes_, *iosock_, *peer_));
// Perform any necessary operations prior to processing an incoming
// query (e.g., checking for queued configuration messages).
More information about the bind10-changes
mailing list