diff options
author | Vadim Yanitskiy <vyanitskiy@sysmocom.de> | 2022-07-30 05:33:36 +0700 |
---|---|---|
committer | Vadim Yanitskiy <vyanitskiy@sysmocom.de> | 2022-08-08 14:11:21 +0700 |
commit | b3aece32397ee895efbb31f033d3f1ee401bee76 (patch) | |
tree | 1f01f94d8e0ee0709d7f3f99b859eafb1ab0ac51 | |
parent | 12d1b9788efd5cff7714e61f844bc8bdd4f3d388 (diff) |
trxcon: improve L1CTL connection related logging
* l1ctl_client_conn_close(): log "Closing L1CTL connection";
* l1ctl_client_read_cb(): more precise logging, use strerror().
Change-Id: Ie932513f93fd7f1a5f5e70f4d78235551f7599c8
Related: OS#5599
-rw-r--r-- | src/host/trxcon/src/l1ctl_server.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/host/trxcon/src/l1ctl_server.c b/src/host/trxcon/src/l1ctl_server.c index cf98c6f8..bfbd9976 100644 --- a/src/host/trxcon/src/l1ctl_server.c +++ b/src/host/trxcon/src/l1ctl_server.c @@ -50,12 +50,16 @@ static int l1ctl_client_read_cb(struct osmo_fd *ofd) /* Attempt to read from socket */ rc = read(ofd->fd, &len, L1CTL_MSG_LEN_FIELD); - if (rc < L1CTL_MSG_LEN_FIELD) { - LOGP_CLI(client, DL1D, LOGL_NOTICE, - "L1CTL server has lost connection (id=%u)\n", - client->id); - if (rc >= 0) + if (rc != L1CTL_MSG_LEN_FIELD) { + if (rc <= 0) { + LOGP_CLI(client, DL1D, LOGL_NOTICE, + "L1CTL connection error: read() failed (rc=%d): %s\n", + rc, strerror(errno)); + } else { + LOGP_CLI(client, DL1D, LOGL_NOTICE, + "L1CTL connection error: short read\n"); rc = -EIO; + } l1ctl_client_conn_close(client); return rc; } @@ -199,6 +203,8 @@ void l1ctl_client_conn_close(struct l1ctl_client *client) { struct l1ctl_server *server = client->server; + LOGP_CLI(client, DL1C, LOGL_NOTICE, "Closing L1CTL connection\n"); + if (server->cfg->conn_close_cb != NULL) server->cfg->conn_close_cb(client); |