|
OpenTTD Source
14.0-beta1
|
Socket handler for the survey connection. More...
#include <network_survey.h>
Public Types | |
| enum | Reason { Reason::PREVIEW, Reason::LEAVE, Reason::EXIT, Reason::CRASH } |
Public Member Functions | |
| void | Transmit (Reason reason, bool blocking=false) |
| Transmit the survey. More... | |
| std::string | CreatePayload (Reason reason, bool for_preview=false) |
Public Member Functions inherited from HTTPCallback | |
| virtual | ~HTTPCallback ()=default |
| Silentium. | |
Static Public Member Functions | |
| constexpr static bool | IsSurveyPossible () |
Protected Member Functions | |
| void | OnFailure () override |
| An error has occurred and the connection has been closed. More... | |
| void | OnReceiveData (std::unique_ptr< char[]> data, size_t length) override |
| We're receiving data. More... | |
| bool | IsCancelled () const override |
| Check if there is a request to cancel the transfer. More... | |
Private Attributes | |
| std::mutex | mutex |
| Mutex for the condition variable. | |
| std::atomic< bool > | transmitted |
| Whether the survey has been transmitted. | |
| std::condition_variable | transmitted_cv |
| Condition variable to inform changes to transmitted. | |
Socket handler for the survey connection.
Definition at line 20 of file network_survey.h.
|
strong |
| Enumerator | |
|---|---|
| PREVIEW | User is previewing the survey result. |
| LEAVE | User is leaving the game (but not exiting the application). |
| EXIT | User is exiting the application. |
| CRASH | Game crashed. |
Definition at line 27 of file network_survey.h.
|
inlineoverrideprotectedvirtual |
Check if there is a request to cancel the transfer.
Implements HTTPCallback.
Definition at line 24 of file network_survey.h.
|
overrideprotectedvirtual |
An error has occurred and the connection has been closed.
Implements HTTPCallback.
Definition at line 115 of file network_survey.cpp.
References Debug, transmitted, and transmitted_cv.
|
overrideprotectedvirtual |
We're receiving data.
| data | the received data, nullptr when all data has been received. |
| length | the amount of received data, 0 when all data has been received. |
Implements HTTPCallback.
Definition at line 122 of file network_survey.cpp.
References Debug, transmitted, and transmitted_cv.
| void NetworkSurveyHandler::Transmit | ( | Reason | reason, |
| bool | blocking = false |
||
| ) |
Transmit the survey.
| reason | The reason for sending the survey. |
| blocking | Whether to block until the survey is sent. |
Definition at line 87 of file network_survey.cpp.
References _settings_client, Debug, ClientSettings::network, and NetworkSettings::participate_survey.