Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISC Open Source Projects
Kea
Commits
2835b3c5
Commit
2835b3c5
authored
Feb 16, 2017
by
Marcin Siodelski
Browse files
[5099] Addressed review comments.
parent
cbc30863
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/lib/asiolink/tcp_socket.h
View file @
2835b3c5
...
...
@@ -110,6 +110,7 @@ public:
/// \param endpoint Target of the send. (Unused for a TCP socket because
/// that was determined when the connection was opened.)
/// \param callback Callback object.
/// \throw BufferTooLarge on attempt to send a buffer larger than 64kB.
virtual
void
asyncSend
(
const
void
*
data
,
size_t
length
,
const
IOEndpoint
*
endpoint
,
C
&
callback
);
...
...
@@ -124,6 +125,7 @@ public:
/// \param data Data to send
/// \param length Length of data to send
/// \param callback Callback object.
/// \throw BufferTooLarge on attempt to send a buffer larger than 64kB.
void
asyncSend
(
const
void
*
data
,
size_t
length
,
C
&
callback
);
/// \brief Receive Asynchronously
...
...
src/lib/http/connection_pool.cc
View file @
2835b3c5
...
...
@@ -12,13 +12,13 @@ namespace http {
void
HttpConnectionPool
::
start
(
const
HttpConnectionPtr
&
connection
)
{
connections_
.
insert
(
connection
);
connections_
.
insert
(
connections_
.
end
(),
connection
);
connection
->
asyncAccept
();
}
void
HttpConnectionPool
::
stop
(
const
HttpConnectionPtr
&
connection
)
{
connections_
.
eras
e
(
connection
);
connections_
.
remov
e
(
connection
);
}
void
...
...
src/lib/http/connection_pool.h
View file @
2835b3c5
...
...
@@ -8,7 +8,7 @@
#define HTTP_CONNECTION_POOL_H
#include <http/connection.h>
#include <s
e
t>
#include <
li
st>
namespace
isc
{
namespace
http
{
...
...
@@ -49,7 +49,7 @@ public:
protected:
/// @brief Set of connections.
std
::
s
e
t
<
HttpConnectionPtr
>
connections_
;
std
::
li
st
<
HttpConnectionPtr
>
connections_
;
};
...
...
src/lib/http/response_creator_factory.h
View file @
2835b3c5
...
...
@@ -36,9 +36,6 @@ class HttpResponseCreatorFactory {
public:
/// @brief Virtual destructor.
///
/// The implementation doesn't need to declare virtual destructor because
/// it is already implemented here.
virtual
~
HttpResponseCreatorFactory
()
{
}
/// @brief Returns an instance of the @ref HttpResponseCreator.
...
...
src/lib/http/tests/connection_pool_unittests.cc
View file @
2835b3c5
...
...
@@ -16,6 +16,7 @@
#include <http/tests/response_test.h>
#include <boost/shared_ptr.hpp>
#include <gtest/gtest.h>
#include <algorithm>
using
namespace
isc
::
asiolink
;
using
namespace
isc
::
http
;
...
...
@@ -81,6 +82,12 @@ public:
using
HttpConnectionPool
::
connections_
;
/// @brief Checks if specified connection belongs to the pool.
bool
hasConnection
(
const
HttpConnectionPtr
&
conn
)
const
{
return
(
std
::
find
(
connections_
.
begin
(),
connections_
.
end
(),
conn
)
!=
connections_
.
end
());
}
};
/// @brief Test fixture class for @ref HttpConnectionPool.
...
...
@@ -120,19 +127,19 @@ TEST_F(HttpConnectionPoolTest, startStop) {
// Start first connection and check that it has been added to the pool.
ASSERT_NO_THROW
(
pool
.
start
(
conn1
));
ASSERT_EQ
(
1
,
pool
.
connections_
.
size
());
ASSERT_EQ
(
1
,
pool
.
c
onnection
s_
.
count
(
conn1
));
ASSERT_EQ
(
1
,
pool
.
hasC
onnection
(
conn1
));
// Start second connection and check that it also has been added.
ASSERT_NO_THROW
(
pool
.
start
(
conn2
));
ASSERT_EQ
(
2
,
pool
.
connections_
.
size
());
ASSERT_EQ
(
1
,
pool
.
c
onnection
s_
.
count
(
conn2
));
ASSERT_EQ
(
1
,
pool
.
hasC
onnection
(
conn2
));
// Stop first connection.
ASSERT_NO_THROW
(
pool
.
stop
(
conn1
));
ASSERT_EQ
(
1
,
pool
.
connections_
.
size
());
// Check that it has been removed but the second connection is still there.
ASSERT_EQ
(
0
,
pool
.
c
onnection
s_
.
count
(
conn1
));
ASSERT_EQ
(
1
,
pool
.
c
onnection
s_
.
count
(
conn2
));
ASSERT_EQ
(
0
,
pool
.
hasC
onnection
(
conn1
));
ASSERT_EQ
(
1
,
pool
.
hasC
onnection
(
conn2
));
// Remove second connection and verify.
ASSERT_NO_THROW
(
pool
.
stop
(
conn2
));
...
...
@@ -179,7 +186,7 @@ TEST_F(HttpConnectionPoolTest, stopInvalid) {
ASSERT_NO_THROW
(
pool
.
start
(
conn1
));
ASSERT_NO_THROW
(
pool
.
stop
(
conn2
));
ASSERT_EQ
(
1
,
pool
.
connections_
.
size
());
ASSERT_EQ
(
1
,
pool
.
c
onnection
s_
.
count
(
conn1
));
ASSERT_EQ
(
1
,
pool
.
hasC
onnection
(
conn1
));
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment