Some clean-ups

This commit is contained in:
Alex Hultman
2018-09-15 05:31:42 +02:00
parent eee6e97fda
commit 883bdfe7d7
11 changed files with 41 additions and 53 deletions
-29
View File
@@ -15,24 +15,6 @@ protected:
using SOCKET_TYPE = typename StaticDispatch<SSL>::SOCKET_TYPE;
using StaticDispatch<SSL>::static_dispatch;
// this will have to belong here for now
int u32toa(uint32_t value, char *dst) {
char temp[10];
char *p = temp;
do {
*p++ = (char) (value % 10) + '0';
value /= 10;
} while (value > 0);
int ret = p - temp;
do {
*dst++ = *--p;
} while (p != temp);
return ret;
}
LoopData *getLoopData() {
if constexpr(SSL) {
return (LoopData *) us_loop_ext(us_ssl_socket_context_loop(us_ssl_socket_get_context((SOCKET_TYPE *) this)));
@@ -138,17 +120,6 @@ public:
return length;
}
/* Write an unsigned 32-bit integer */
void writeUnsigned(unsigned int value) {
LoopData *loopData = getLoopData();
char buf[10];
int length = u32toa(value, buf);
// for now we do this copy
write(buf, length);
}
/* Uncork this socket and flush or buffer any corked and/or passed data. It is essential to remember doing this. */
/* It does NOT count bytes written from cork buffer (they are already accounted for in the write call responsible for its corking)! */
int uncork(const char *src = nullptr, int length = 0, bool optionally = false) {