Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
ee24b9f8
"git@developer.sourcefind.cn:OpenDAS/torch-cluster.git" did not exist on "7587ce48baac0a49a9d0e275d3133a7cd19f7f2e"
Commit
ee24b9f8
authored
Nov 17, 2012
by
Davis King
Browse files
Made close_gracefully() into a noop if called on a null pointer.
parent
e88aab79
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
20 deletions
+28
-20
dlib/sockets/sockets_extensions.cpp
dlib/sockets/sockets_extensions.cpp
+3
-0
dlib/sockets/sockets_extensions_abstract.h
dlib/sockets/sockets_extensions_abstract.h
+25
-20
No files found.
dlib/sockets/sockets_extensions.cpp
View file @
ee24b9f8
...
@@ -304,6 +304,9 @@ namespace dlib
...
@@ -304,6 +304,9 @@ namespace dlib
unsigned
long
timeout
unsigned
long
timeout
)
)
{
{
if
(
!
con
)
return
;
if
(
con
->
shutdown_outgoing
())
if
(
con
->
shutdown_outgoing
())
{
{
// there was an error so just close it now and return
// there was an error so just close it now and return
...
...
dlib/sockets/sockets_extensions_abstract.h
View file @
ee24b9f8
...
@@ -200,17 +200,19 @@ namespace dlib
...
@@ -200,17 +200,19 @@ namespace dlib
);
);
/*!
/*!
requires
requires
- con == a valid pointer to a connection object
- con == a valid pointer to a connection object
or 0
ensures
ensures
- performs a graceful close of the given connection and if it takes longer than
- This function does nothing if con == 0, otherwise it performs the following:
timeout milliseconds to complete then forces the connection closed.
- performs a graceful close of the given connection and if it takes longer
than timeout milliseconds to complete then forces the connection closed.
- Specifically, a graceful close means that the outgoing part of con is
- Specifically, a graceful close means that the outgoing part of con is
closed (a FIN is sent) and then we wait for the other end to to close their
closed (a FIN is sent) and then we wait for the other end to to close
end of the connection. This way any data still on its way to the other
their end of the connection. This way any data still on its way to
end of the connection will be received properly.
the other end of the connection will be received properly.
- this function will block until the graceful close is completed or we timeout.
- This function will block until the graceful close is completed or we
- calls "delete con;". Thus con is no longer a valid pointer after this function
timeout.
has finished.
- calls "delete con;". Thus con is no longer a valid pointer after this
function has finished.
throws
throws
- std::bad_alloc or dlib::thread_error
- std::bad_alloc or dlib::thread_error
If either of these exceptions are thrown con will still be closed via
If either of these exceptions are thrown con will still be closed via
...
@@ -225,17 +227,20 @@ namespace dlib
...
@@ -225,17 +227,20 @@ namespace dlib
);
);
/*!
/*!
requires
requires
- con == a valid pointer to a connection object
- con == a valid pointer to a connection object
or con.get() == 0
ensures
ensures
- performs a graceful close of the given connection and if it takes longer than
- This function does nothing if con.get() == 0, otherwise it performs the
timeout milliseconds to complete then forces the connection closed.
following:
- performs a graceful close of the given connection and if it takes longer
than timeout milliseconds to complete then forces the connection closed.
- Specifically, a graceful close means that the outgoing part of con is
- Specifically, a graceful close means that the outgoing part of con is
closed (a FIN is sent) and then we wait for the other end to to close their
closed (a FIN is sent) and then we wait for the other end to to close
end of the connection. This way any data still on its way to the other
their end of the connection. This way any data still on its way to
end of the connection will be received properly.
the other end of the connection will be received properly.
- this function will block until the graceful close is completed or we timeout.
- This function will block until the graceful close is completed or we
- #con.get() == 0. Thus con is no longer a valid pointer after this function
timeout.
has finished.
- #con.get() == 0. Thus con is no longer a valid pointer after this
function has finished.
throws
throws
- std::bad_alloc or dlib::thread_error
- std::bad_alloc or dlib::thread_error
If either of these exceptions are thrown con will still be closed and
If either of these exceptions are thrown con will still be closed and
...
...
Write
Preview
Markdown
is supported
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