src/nexus.c
changeset 5 a09a0797f6f0
parent 4 a3ca0f97a075
child 6 240ae8482d64
equal deleted inserted replaced
4:a3ca0f97a075 5:a09a0797f6f0
     9 #include <err.h>
     9 #include <err.h>
    10 
    10 
    11 #include "sock.h"
    11 #include "sock.h"
    12 
    12 
    13 #define CONNECT_HOST "irc.fixme.fi"
    13 #define CONNECT_HOST "irc.fixme.fi"
    14 #define CONNECT_SERV "6697"
    14 #define CONNECT_SERV "6667"
    15 #define LINE_LENGTH 512
    15 #define LINE_LENGTH 512
    16 
    16 
    17 struct recvline_state {
    17 struct recvline_state {
    18     size_t tail_offset;
    18     size_t tail_offset;
    19     size_t tail_len;
    19     size_t tail_len;
   116         errx(1, "sock_init");
   116         errx(1, "sock_init");
   117 
   117 
   118     memset(&recvline_ctx, 0, sizeof(recvline_ctx));
   118     memset(&recvline_ctx, 0, sizeof(recvline_ctx));
   119     
   119     
   120     // over-simplified connect
   120     // over-simplified connect
   121     sock = sock_ssl_connect(CONNECT_HOST, CONNECT_SERV);
   121     if (sock_gnutls_connect(&sock, CONNECT_HOST, CONNECT_SERV, &err))
       
   122         // XXX:
       
   123         errx(1, "sock_gnutls_connect");
   122 
   124 
   123     // read lines and dump them out
   125     // read lines and dump them out
   124     do {
   126     do {
   125         // recv
   127         // recv
   126         recvline(sock, line_buf, sizeof(line_buf), &recvline_ctx);
   128         recvline(sock, line_buf, sizeof(line_buf), &recvline_ctx);