summaryrefslogtreecommitdiff
path: root/vchat-connection.c
diff options
context:
space:
mode:
Diffstat (limited to 'vchat-connection.c')
-rw-r--r--vchat-connection.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/vchat-connection.c b/vchat-connection.c
index 9770115..7c204fd 100644
--- a/vchat-connection.c
+++ b/vchat-connection.c
@@ -35,10 +35,6 @@
35static int serverfd = -1; 35static int serverfd = -1;
36unsigned int want_tcp_keepalive = 0; 36unsigned int want_tcp_keepalive = 0;
37 37
38/* TODO: NEEDS TO GO. status-variable from vchat-client.c
39 * eventloop is done as long as this is true */
40extern int status;
41
42/* Generic tcp connector, blocking */ 38/* Generic tcp connector, blocking */
43static int connect_tcp_socket(const char *server, const char *port) { 39static int connect_tcp_socket(const char *server, const char *port) {
44 struct addrinfo hints, *res, *res0; 40 struct addrinfo hints, *res, *res0;
@@ -215,15 +211,14 @@ void vc_receive(void) {
215 /* Our tls functions may require retries with handshakes etc, this is 211 /* Our tls functions may require retries with handshakes etc, this is
216 * signalled by -2 */ 212 * signalled by -2 */
217 if (bytes == -2) 213 if (bytes == -2)
218 return; 214 return 0;
219 215
220 /* Error on the socket read? raise error message, bail out */ 216 /* Error on the socket read? raise error message, bail out */
221 if (bytes == -1) { 217 if (bytes == -1) {
222 snprintf(tmpstr, TMPSTRSIZE, "Receive fails, %s.", strerror(errno)); 218 snprintf(tmpstr, TMPSTRSIZE, "Receive fails, %s.", strerror(errno));
223 snprintf(errstr, ERRSTRSIZE, "Receive fails, %s.\n", strerror(errno)); 219 snprintf(errstr, ERRSTRSIZE, "Receive fails, %s.\n", strerror(errno));
224 writecf(FS_ERR, tmpstr); 220 writecf(FS_ERR, tmpstr);
225 status = 0; 221 return -1;
226 return;
227 } 222 }
228 223
229 /* end of file from server? */ 224 /* end of file from server? */
@@ -231,8 +226,7 @@ void vc_receive(void) {
231 /* inform user, bail out */ 226 /* inform user, bail out */
232 writecf(FS_SERV, "* EOF from server."); 227 writecf(FS_SERV, "* EOF from server.");
233 snprintf(errstr, ERRSTRSIZE, "* EOF from server.\n"); 228 snprintf(errstr, ERRSTRSIZE, "* EOF from server.\n");
234 status = 0; 229 return -1;
235 return;
236 } 230 }
237 231
238 buf_fill += bytes; 232 buf_fill += bytes;
@@ -257,4 +251,5 @@ void vc_receive(void) {
257 buf_fill -= 1 + endmsg - buf; 251 buf_fill -= 1 + endmsg - buf;
258 memmove(buf, endmsg + 1, buf_fill); 252 memmove(buf, endmsg + 1, buf_fill);
259 } 253 }
254 return 0;
260} 255}