mirror of
https://github.com/SFML/CSFML.git
synced 2026-10-27 13:36:12 +01:00
sfTcpListener_accept now returns a null pointer when it fails
This commit is contained in:
1 parent
12b7c5a6a5
commit
91e11cc095
2 files changed
+13
-1
No files matched your search
@@ -112,6 +112,10 @@ CSFML_NETWORK_API sfSocketStatus sfTcpListener_listen(sfTcpListener* listener, u
|
|||||||
/// If the socket is in blocking mode, this function will
|
/// If the socket is in blocking mode, this function will
|
||||||
/// not return until a connection is actually received.
|
/// not return until a connection is actually received.
|
||||||
///
|
///
|
||||||
|
/// The \a connected argument points to a valid sfTcpSocket pointer
|
||||||
|
/// in case of success (the function returns sfSocketDone), it points
|
||||||
|
/// to a NULL pointer otherwise.
|
||||||
|
///
|
||||||
/// \param listener TCP listener object
|
/// \param listener TCP listener object
|
||||||
/// \param connected Socket that will hold the new connection
|
/// \param connected Socket that will hold the new connection
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -82,5 +82,13 @@ sfSocketStatus sfTcpListener_accept(sfTcpListener* listener, sfTcpSocket** conne
|
|||||||
CSFML_CHECK_RETURN(connected, sfSocketError);
|
CSFML_CHECK_RETURN(connected, sfSocketError);
|
||||||
|
|
||||||
*connected = new sfTcpSocket;
|
*connected = new sfTcpSocket;
|
||||||
return static_cast<sfSocketStatus>(listener->This.accept((*connected)->This));
|
sfSocketStatus status = static_cast<sfSocketStatus>(listener->This.accept((*connected)->This));
|
||||||
|
|
||||||
|
if (status != sfSocketDone)
|
||||||
|
{
|
||||||
|
delete *connected;
|
||||||
|
*connected = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return status;
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user