Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorДобрый Ээх <bukharaev@gmail.com>2016-10-12 12:09:53 +0300
committerДобрый Ээх <bukharaev@gmail.com>2016-10-12 12:09:53 +0300
commitfa9b6c3805e070ae78633d35db3cf0c30bd80ea6 (patch)
tree5e873e850865e3c0da4f45f5eb7648eeef3c9142 /platform
parent103ec7828f5f062b06cfa538387067214082b4ce (diff)
pull request #4478 review fixes
Diffstat (limited to 'platform')
-rw-r--r--platform/socket.hpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/platform/socket.hpp b/platform/socket.hpp
index 6002f98eac..c29474902e 100644
--- a/platform/socket.hpp
+++ b/platform/socket.hpp
@@ -1,19 +1,24 @@
#pragma once
-#include "std/mutex.hpp"
#include "std/string.hpp"
#include "std/target_os.hpp"
-#include "std/vector.hpp"
namespace platform
{
class Socket
{
public:
- virtual ~Socket() {}
+ virtual ~Socket() = default;
+
+ // Open/Close contract:
+ // 1. You can call Open+Close pair multiple times for the same Socket instance.
+ // 2. There are should be Close call after each Open call.
+ // 3. Open+Open: second Open does nothing and returns false.
+ // 4. Close+Close: second Close does nothing,
virtual bool Open(string const & host, uint16_t port) = 0;
virtual void Close() = 0;
+ // Read is blocking, it waits for the 'count' data size.
virtual bool Read(uint8_t * data, uint32_t count) = 0;
virtual bool Write(uint8_t const * data, uint32_t count) = 0;
@@ -31,5 +36,4 @@ class PlatformSocket final : public Socket
bool Write(uint8_t const * data, uint32_t count) override;
void SetTimeout(uint32_t milliseconds) override;
};
-
} // namespace platform