Browse Source

Update to new codec2 version.

Add keepalive option to sockets to monitor quiet ones.
master
Jeroen Vreeken 3 years ago
parent
commit
eaf3896f99
3 changed files with 12 additions and 4 deletions
  1. +3
    -3
      dml_client.c
  2. +3
    -1
      dml_stream_client_simple.c
  3. +6
    -0
      trx_dv.c

+ 3
- 3
dml_client.c View File

@ -87,7 +87,7 @@ int dml_client_connect(struct dml_client *dc)
struct addrinfo *result;
struct addrinfo *entry;
struct addrinfo hints = { 0 };
int error, i;
int error;
int sock = -1;
char *port;
@ -110,8 +110,8 @@ int dml_client_connect(struct dml_client *dc)
close(sock);
sock = -1;
} else {
i = 1;
setsockopt (sock, IPPROTO_TCP, TCP_NODELAY, &i, sizeof (int));
setsockopt (sock, IPPROTO_TCP, TCP_NODELAY, &(int){1}, sizeof (int));
setsockopt (sock, SOL_SOCKET, SO_KEEPALIVE, &(int){1}, sizeof (int));
break;
}
}


+ 3
- 1
dml_stream_client_simple.c View File

@ -131,8 +131,10 @@ static void rx_packet(struct dml_connection *dc, void *arg,
size_t size;
fprintf(stderr, "Parse certificate\n");
if (dml_packet_parse_certificate(data, len, cid, &cert, &size))
if (dml_packet_parse_certificate(data, len, cid, &cert, &size)) {
fprintf(stderr, "Failed to parse certificate\n");
break;
}
fprintf(stderr, "verify %d\n", dss->verify);
if (!dss->verify || !dml_crypto_cert_add_verify(cert, size, cid)) {
fprintf(stderr, "Request header\n");


+ 6
- 0
trx_dv.c View File

@ -92,10 +92,12 @@ static int trx_dv_in_cb(void *arg)
mode = CODEC2_MODE_700C;
datasize = 4;
break;
#if defined(CODEC2_MODE_WB)
case ETH_P_CODEC2_WB:
mode = CODEC2_MODE_WB;
datasize = 8;
break;
#endif
case ETH_P_CODEC2_450:
mode = CODEC2_MODE_450;
datasize = 3;
@ -184,10 +186,12 @@ int trx_dv_send(uint8_t from[6], uint8_t to[6], int mode, uint8_t *dv, size_t si
type = htons(ETH_P_CODEC2_700C);
max_size = 4;
break;
#if defined(CODEC2_MODE_WB)
case CODEC2_MODE_WB:
type = htons(ETH_P_CODEC2_WB);
max_size = 8;
break;
#endif
case CODEC2_MODE_450:
type = htons(ETH_P_CODEC2_450);
max_size = 3;
@ -302,8 +306,10 @@ int trx_dv_duration(size_t size, int mode)
return (size * 40) / 3;
case CODEC2_MODE_450PWB:
return (size * 40) / 3;
#if defined(CODEC2_MODE_WB)
case CODEC2_MODE_WB:
return (size * 20) / 8;
#endif
case 'A':
case 'U':
return size / 8;


Loading…
Cancel
Save