Commit cf3eb7b3bce4d5a77db42d712070d94be494d1b2
1 parent
6c66a61b
Fix uninitialized read_chunk_size in all communication endpoint constructor calls
Showing
3 changed files
with
18 additions
and
7 deletions
| @@ -27,7 +27,11 @@ | @@ -27,7 +27,11 @@ | ||
| 27 | #include "tr/connect_entry_point.h" | 27 | #include "tr/connect_entry_point.h" |
| 28 | 28 | ||
| 29 | void | 29 | void |
| 30 | -TR_serverBindTcp(TR_Server this, const char * host, int port, TR_Protocol proto) | 30 | +TR_serverBindTcp( |
| 31 | + TR_Server this, | ||
| 32 | + const char * host, | ||
| 33 | + int port, | ||
| 34 | + TR_Protocol proto) | ||
| 31 | { | 35 | { |
| 32 | TR_Socket socket = (TR_Socket)TR_new( | 36 | TR_Socket socket = (TR_Socket)TR_new( |
| 33 | TR_TcpSocket, | 37 | TR_TcpSocket, |
| @@ -35,7 +39,9 @@ TR_serverBindTcp(TR_Server this, const char * host, int port, TR_Protocol proto) | @@ -35,7 +39,9 @@ TR_serverBindTcp(TR_Server this, const char * host, int port, TR_Protocol proto) | ||
| 35 | host, | 39 | host, |
| 36 | port, 0); | 40 | port, 0); |
| 37 | 41 | ||
| 38 | - TR_serverAddEndpoint(this, TR_new(TR_ConnEntryPoint, socket, proto)); | 42 | + TR_serverAddEndpoint( |
| 43 | + this, | ||
| 44 | + TR_new(TR_ConnEntryPoint, socket, proto, 2048)); | ||
| 39 | } | 45 | } |
| 40 | 46 | ||
| 41 | // vim: set ts=4 sw=4: | 47 | // vim: set ts=4 sw=4: |
| @@ -27,7 +27,11 @@ | @@ -27,7 +27,11 @@ | ||
| 27 | #include "tr/datagram_entry_point.h" | 27 | #include "tr/datagram_entry_point.h" |
| 28 | 28 | ||
| 29 | void | 29 | void |
| 30 | -TR_serverBindUdp(TR_Server this, const char * host, int port, TR_Protocol proto) | 30 | +TR_serverBindUdp( |
| 31 | + TR_Server this, | ||
| 32 | + const char * host, | ||
| 33 | + int port, | ||
| 34 | + TR_Protocol proto) | ||
| 31 | { | 35 | { |
| 32 | TR_Socket socket = (TR_Socket)TR_new( | 36 | TR_Socket socket = (TR_Socket)TR_new( |
| 33 | TR_UdpSocket, | 37 | TR_UdpSocket, |
| @@ -35,7 +39,8 @@ TR_serverBindUdp(TR_Server this, const char * host, int port, TR_Protocol proto) | @@ -35,7 +39,8 @@ TR_serverBindUdp(TR_Server this, const char * host, int port, TR_Protocol proto) | ||
| 35 | host, | 39 | host, |
| 36 | port, 0); | 40 | port, 0); |
| 37 | 41 | ||
| 38 | - TR_serverAddEndpoint(this, TR_new(TR_DatagramEntryPoint, socket, proto)); | 42 | + TR_serverAddEndpoint( |
| 43 | + this, TR_new(TR_DatagramEntryPoint, socket, proto, 2048)); | ||
| 39 | } | 44 | } |
| 40 | 45 | ||
| 41 | // vim: set ts=4 sw=4: | 46 | // vim: set ts=4 sw=4: |
| @@ -27,18 +27,18 @@ main (int argc, char * argv[]) | @@ -27,18 +27,18 @@ main (int argc, char * argv[]) | ||
| 27 | #endif | 27 | #endif |
| 28 | TR_SimpleClient client; | 28 | TR_SimpleClient client; |
| 29 | TR_Protocol protocol; | 29 | TR_Protocol protocol; |
| 30 | - TR_ProtoMessageRaw message; | 30 | + volatile TR_ProtoMessageRaw message; |
| 31 | int i, j=0; | 31 | int i, j=0; |
| 32 | 32 | ||
| 33 | TR_logger = TR_INSTANCE_CAST(TR_Logger, mylogger2); | 33 | TR_logger = TR_INSTANCE_CAST(TR_Logger, mylogger2); |
| 34 | protocol = TR_new(TR_ProtocolRaw); | 34 | protocol = TR_new(TR_ProtocolRaw); |
| 35 | #if UDP | 35 | #if UDP |
| 36 | socket = TR_new(TR_UdpSocket, TR_logger, "127.0.0.1", 5678, 0); | 36 | socket = TR_new(TR_UdpSocket, TR_logger, "127.0.0.1", 5678, 0); |
| 37 | - connection = TR_new(TR_DatagramService, socket, protocol); | 37 | + connection = TR_new(TR_DatagramService, socket, protocol, 2048); |
| 38 | TR_socketOpen((TR_Socket)socket); | 38 | TR_socketOpen((TR_Socket)socket); |
| 39 | #else | 39 | #else |
| 40 | socket = TR_new(TR_TcpSocket, TR_logger, "127.0.0.1", 5678, 0); | 40 | socket = TR_new(TR_TcpSocket, TR_logger, "127.0.0.1", 5678, 0); |
| 41 | - connection = TR_new(TR_Connection, socket, protocol); | 41 | + connection = TR_new(TR_Connection, socket, protocol, 2048); |
| 42 | TR_socketConnect((TR_Socket)socket); | 42 | TR_socketConnect((TR_Socket)socket); |
| 43 | #endif | 43 | #endif |
| 44 | 44 |
Please
register
or
login
to post a comment