Revision 14
added a write function to the connection pool
client.cpp | ||
---|---|---|
45 | 45 |
int value = (int)(pkt->data[0]); |
46 | 46 |
snprintf(buffer, WRITE_BUFFER_SIZE, "%d\n", value); |
47 | 47 |
|
48 |
//TODO:make a connection pool write function and move this code into it |
|
49 | 48 |
int len = strlen(buffer); |
50 |
if (len > (WRITE_BUFFER_SIZE-connection_pool.get_write_buffer_size(dest))) |
|
51 |
{ |
|
52 |
printf("There is not enough room in the write buffer to send the data to the client.\n"); |
|
53 |
return -1; |
|
54 |
} |
|
55 |
|
|
56 |
memcpy(connection_pool.get_write_buffer(dest), buffer, len); |
|
57 |
connection_pool.set_write_buffer_size(dest, len); |
|
49 |
connection_pool.write_to_client(dest, buffer, len); |
|
58 | 50 |
printf("Put data in write buffer for client.\n"); |
59 | 51 |
} |
60 | 52 |
else |
Also available in: Unified diff