summaryrefslogtreecommitdiff
path: root/client.c
diff options
context:
space:
mode:
authorAnsa89 <ansalonistefano@gmail.com>2016-05-02 10:53:59 +0200
committerAnsa89 <ansalonistefano@gmail.com>2016-05-02 12:21:51 +0200
commit91d9ad27d4a7ca77c615bcf9d928f11b9d3b3c77 (patch)
tree983f439fe74e33e873a7325b68e5e3d6fd1cf630 /client.c
parentec84ddcf7ae148117fc0c5edb82d02eb98ee9db3 (diff)
Fix some warnings
Diffstat (limited to 'client.c')
-rw-r--r--client.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/client.c b/client.c
index bfcab14..f812a02 100644
--- a/client.c
+++ b/client.c
@@ -23,7 +23,7 @@ int bind_sockfd;
23 23
24fd_set client_master_fdset; 24fd_set client_master_fdset;
25 25
26int handle_pong_frame(protocol_frame *rcvd_frame) 26int handle_pong_frame()
27{ 27{
28 struct timespec pong_rcvd_time; 28 struct timespec pong_rcvd_time;
29 double secs1, secs2; 29 double secs1, secs2;
@@ -175,7 +175,6 @@ int handle_server_tcp_frame(protocol_frame *rcvd_frame)
175 while(offset < rcvd_frame->data_length) 175 while(offset < rcvd_frame->data_length)
176 { 176 {
177 int sent_bytes; 177 int sent_bytes;
178 int write_sockfd;
179 178
180 if(client_pipe_mode) 179 if(client_pipe_mode)
181 { 180 {
@@ -198,10 +197,10 @@ int handle_server_tcp_frame(protocol_frame *rcvd_frame)
198 197
199 if(sent_bytes < 0) 198 if(sent_bytes < 0)
200 { 199 {
201 char data[PROTOCOL_BUFFER_OFFSET]; 200 uint8_t data[PROTOCOL_BUFFER_OFFSET];
202 protocol_frame frame_st, *frame; 201 protocol_frame frame_st, *frame;
203 202
204 log_printf(L_INFO, "Could not write to socket %d: %s\n", write_sockfd, strerror(errno)); 203 log_printf(L_INFO, "Could not write to socket: %s\n", strerror(errno));
205 204
206 frame = &frame_st; 205 frame = &frame_st;
207 memset(frame, 0, sizeof(protocol_frame)); 206 memset(frame, 0, sizeof(protocol_frame));
@@ -227,7 +226,6 @@ int handle_server_tcp_frame(protocol_frame *rcvd_frame)
227int handle_server_tcp_fin_frame(protocol_frame *rcvd_frame) 226int handle_server_tcp_fin_frame(protocol_frame *rcvd_frame)
228{ 227{
229 tunnel *tun=NULL; 228 tunnel *tun=NULL;
230 int offset = 0;
231 int connid = rcvd_frame->connid; 229 int connid = rcvd_frame->connid;
232 230
233 HASH_FIND_INT(by_id, &connid, tun); 231 HASH_FIND_INT(by_id, &connid, tun);
@@ -250,7 +248,7 @@ int handle_server_tcp_fin_frame(protocol_frame *rcvd_frame)
250} 248}
251 249
252/* Main loop for the client */ 250/* Main loop for the client */
253int do_client_loop(char *tox_id_str) 251int do_client_loop(uint8_t *tox_id_str)
254{ 252{
255 unsigned char tox_packet_buf[PROTOCOL_MAX_PACKET_SIZE]; 253 unsigned char tox_packet_buf[PROTOCOL_MAX_PACKET_SIZE];
256 unsigned char tox_id[TOX_ADDRESS_SIZE]; 254 unsigned char tox_id[TOX_ADDRESS_SIZE];
@@ -298,15 +296,15 @@ int do_client_loop(char *tox_id_str)
298 break; 296 break;
299 case CLIENT_STATE_CONNECTED: 297 case CLIENT_STATE_CONNECTED:
300 { 298 {
301 uint8_t* data = "Hi, fellow tuntox instance!"; 299 uint8_t* data = (uint8_t *)"Hi, fellow tuntox instance!";
302 uint16_t length = sizeof(data); 300 uint16_t length = sizeof(data);
303 TOX_ERR_FRIEND_ADD add_error; 301 TOX_ERR_FRIEND_ADD add_error;
304 302
305 if(use_shared_secret) 303 if(use_shared_secret)
306 { 304 {
307 data = shared_secret; 305 data = (uint8_t *)shared_secret;
308 data[TOX_MAX_FRIEND_REQUEST_LENGTH-1] = '\0'; 306 data[TOX_MAX_FRIEND_REQUEST_LENGTH-1] = '\0';
309 length = strlen(data)+1; 307 length = strlen((char *)data)+1;
310 log_printf(L_DEBUG, "Sent shared secret of length %u\n", length); 308 log_printf(L_DEBUG, "Sent shared secret of length %u\n", length);
311 } 309 }
312 310
@@ -492,7 +490,7 @@ int do_client_loop(char *tox_id_str)
492 /* Check if connection closed */ 490 /* Check if connection closed */
493 if(nbytes == 0) 491 if(nbytes == 0)
494 { 492 {
495 char data[PROTOCOL_BUFFER_OFFSET]; 493 uint8_t data[PROTOCOL_BUFFER_OFFSET];
496 protocol_frame frame_st, *frame; 494 protocol_frame frame_st, *frame;
497 495
498 log_printf(L_INFO, "Connection closed\n"); 496 log_printf(L_INFO, "Connection closed\n");