cNetwork: Renamed callback to OnConnected()
This commit is contained in:
parent
dbf7f13bd4
commit
9014bdfa32
@ -16,6 +16,10 @@
|
|||||||
// fwd:
|
// fwd:
|
||||||
class cTCPLink;
|
class cTCPLink;
|
||||||
typedef SharedPtr<cTCPLink> cTCPLinkPtr;
|
typedef SharedPtr<cTCPLink> cTCPLinkPtr;
|
||||||
|
typedef std::vector<cTCPLinkPtr> cTCPLinkPtrs;
|
||||||
|
class cServerHandle;
|
||||||
|
typedef SharedPtr<cServerHandle> cServerHandlePtr;
|
||||||
|
typedef std::vector<cServerHandlePtr> cServerHandlePtrs;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -118,7 +122,6 @@ public:
|
|||||||
/** Returns true if the server has been started correctly and is currently listening for incoming connections. */
|
/** Returns true if the server has been started correctly and is currently listening for incoming connections. */
|
||||||
virtual bool IsListening(void) const = 0;
|
virtual bool IsListening(void) const = 0;
|
||||||
};
|
};
|
||||||
typedef SharedPtr<cServerHandle> cServerHandlePtr;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -136,7 +139,7 @@ public:
|
|||||||
|
|
||||||
/** Called when the Connect call succeeds.
|
/** Called when the Connect call succeeds.
|
||||||
Provides the newly created link that can be used for communication. */
|
Provides the newly created link that can be used for communication. */
|
||||||
virtual void OnSuccess(cTCPLink & a_Link) = 0;
|
virtual void OnConnected(cTCPLink & a_Link) = 0;
|
||||||
|
|
||||||
/** Called when the Connect call fails. */
|
/** Called when the Connect call fails. */
|
||||||
virtual void OnError(int a_ErrorCode, const AString & a_ErrorMsg) = 0;
|
virtual void OnError(int a_ErrorCode, const AString & a_ErrorMsg) = 0;
|
||||||
|
@ -213,7 +213,7 @@ void cTCPLinkImpl::EventCallback(bufferevent * a_BufferEvent, short a_What, void
|
|||||||
{
|
{
|
||||||
if (Self->m_ConnectCallbacks != nullptr)
|
if (Self->m_ConnectCallbacks != nullptr)
|
||||||
{
|
{
|
||||||
Self->m_ConnectCallbacks->OnSuccess(*Self);
|
Self->m_ConnectCallbacks->OnConnected(*Self);
|
||||||
// Reset the connect callbacks so that later errors get reported through the link callbacks:
|
// Reset the connect callbacks so that later errors get reported through the link callbacks:
|
||||||
Self->m_ConnectCallbacks.reset();
|
Self->m_ConnectCallbacks.reset();
|
||||||
return;
|
return;
|
||||||
|
@ -17,7 +17,7 @@ class cHTTPConnectCallbacks:
|
|||||||
public cNetwork::cConnectCallbacks
|
public cNetwork::cConnectCallbacks
|
||||||
{
|
{
|
||||||
cEvent & m_Event;
|
cEvent & m_Event;
|
||||||
virtual void OnSuccess(cTCPLink & a_Link) override
|
virtual void OnConnected(cTCPLink & a_Link) override
|
||||||
{
|
{
|
||||||
LOGD("Connected, sending HTTP GET");
|
LOGD("Connected, sending HTTP GET");
|
||||||
if (!a_Link.Send("GET / HTTP/1.0\r\nHost:google.com\r\n\r\n"))
|
if (!a_Link.Send("GET / HTTP/1.0\r\nHost:google.com\r\n\r\n"))
|
||||||
|
Loading…
Reference in New Issue
Block a user