pcu_sock: add pcu_connected() to query PCU availability

Will be used in upcoming dyn PDCH switching.

Change-Id: I8031089ad5e9cb9690ca7e22facc53438f28e12a
This commit is contained in:
Neels Hofmeyr 2016-06-16 03:26:50 +02:00 committed by Neels Hofmeyr
parent ecd5bc2aef
commit 703c2d6eb8
2 changed files with 12 additions and 0 deletions

View File

@ -19,4 +19,6 @@ int pcu_tx_pch_data_cnf(uint32_t fn, uint8_t *data, uint8_t len);
int pcu_sock_init(const char *path);
void pcu_sock_exit(void);
bool pcu_connected(void);
#endif /* _PCU_IF_H */

View File

@ -922,3 +922,13 @@ int osmo_unixsock_listen(struct osmo_fd *bfd, int type, const char *path)
return 0;
}
bool pcu_connected(void) {
struct gsm_network *net = &bts_gsmnet;
struct pcu_sock_state *state = net->pcu_state;
if (!state)
return false;
if (state->conn_bfd.fd <= 0)
return false;
return true;
}