Ev'ryday I'm bufferin'.
This commit is contained in:
@@ -20,7 +20,7 @@ namespace netprot {
|
||||
|
||||
struct Buffer { // Pour pouvoir rendre l'utilisation des buffers plus clean.
|
||||
char* ptr = new char[BUFFER_LENGTH];
|
||||
int32_t len = BUFFER_LENGTH;
|
||||
uint32_t len = BUFFER_LENGTH;
|
||||
|
||||
~Buffer() { delete[] ptr; }
|
||||
void rstLen() { len = BUFFER_LENGTH; }
|
||||
@@ -157,7 +157,7 @@ namespace netprot {
|
||||
|
||||
template <class T>
|
||||
void sendPack(SOCKET sock, T* pack, Buffer* buf) {
|
||||
netprot::Serialize(pack, buf->ptr, buf->len);
|
||||
netprot::Serialize(pack, &buf->ptr, &buf->len);
|
||||
send(sock, buf->ptr, buf->len, 0);
|
||||
buf->rstLen();
|
||||
}
|
||||
@@ -165,7 +165,7 @@ namespace netprot {
|
||||
template <class T>
|
||||
void sendPackTo(SOCKET sock, T* pack, Buffer* buf, sockaddr_in* sockad) {
|
||||
sockaddr_in addr = *sockad;
|
||||
netprot::Serialize(pack, buf->ptr, buf->len);
|
||||
netprot::Serialize(pack, &buf->ptr, &buf->len);
|
||||
sendto(sock, buf->ptr, buf->len, 0, (sockaddr*)&addr, sizeof(addr));
|
||||
buf->rstLen();
|
||||
}
|
||||
|
Reference in New Issue
Block a user