summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2020-08-22 09:23:44 -0400
committerAndrew Cady <d@jerkface.net>2020-08-22 09:23:44 -0400
commit34867d178d3173e679d54c129e2681a1f9d774f1 (patch)
treef7492e0b5d3a8d879cb4ce1c2cbc9a00c569b714
parentafdfa84369451c54e485acb8aea76b4acb7258b0 (diff)
error handling/reporting
-rw-r--r--client.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/client.c b/client.c
index 5d8e2af..a9493f0 100644
--- a/client.c
+++ b/client.c
@@ -140,10 +140,16 @@ int handle_acktunnel_frame(protocol_frame *rcvd_frame)
140 log_printf(L_WARNING, "Got ACK tunnel frame when not in client mode!?\n"); 140 log_printf(L_WARNING, "Got ACK tunnel frame when not in client mode!?\n");
141 return -1; 141 return -1;
142 } 142 }
143 if(state != CLIENT_STATE_AWAIT_TUNNEL)
144 {
145 log_printf(L_WARNING, "Got ACK tunnel frame in unexpected state (%d); ignoring", state);
146 return -1;
147 }
143 148
144 tun = tunnel_create(client_tunnel.sockfd, rcvd_frame->connid, rcvd_frame->friendnumber); 149 tun = tunnel_create(client_tunnel.sockfd, rcvd_frame->connid, rcvd_frame->friendnumber);
145 if (!tun) 150 if (!tun)
146 { 151 {
152 log_printf(L_ERROR, "Got server ACK but failed to create new tunnel");
147 exit(1); 153 exit(1);
148 } 154 }
149 155
@@ -152,14 +158,6 @@ int handle_acktunnel_frame(protocol_frame *rcvd_frame)
152 158
153 update_select_nfds(tun->sockfd); 159 update_select_nfds(tun->sockfd);
154 FD_SET(tun->sockfd, &client_master_fdset); 160 FD_SET(tun->sockfd, &client_master_fdset);
155 if(program_mode == Mode_Client_Local_Port_Forward)
156 {
157 log_printf(L_INFO, "Accepted a new connection on port %d\n", local_port);
158 }
159 if(state != CLIENT_STATE_AWAIT_TUNNEL)
160 {
161 log_printf(L_WARNING, "Got ACK tunnel frame when state is %d", state);
162 }
163 state = CLIENT_STATE_CONNECTED; 161 state = CLIENT_STATE_CONNECTED;
164 return 0; 162 return 0;
165} 163}