summaryrefslogtreecommitdiff
path: root/src/ipcpd/normal/main.c
diff options
context:
space:
mode:
authordimitri staessens <[email protected]>2017-09-19 16:48:54 +0000
committerSander Vrijders <[email protected]>2017-09-19 16:48:54 +0000
commitacd8235533d63a7e4dd4d1b5bdb17423d4b6fd75 (patch)
tree195bbf3a1aa1923394410db072f72c0b38aede8c /src/ipcpd/normal/main.c
parentc0bbd7e2184f51038ecbaebfa3b21e5c52d35239 (diff)
parent1dcef3957393c0500b81d93ffacf573e78be9a51 (diff)
downloadouroboros-acd8235533d63a7e4dd4d1b5bdb17423d4b6fd75.tar.gz
ouroboros-acd8235533d63a7e4dd4d1b5bdb17423d4b6fd75.zip
Merged in dstaesse/ouroboros/be-dht-async (pull request #598)
ipcpd: Enroll DHT when creating dt connection
Diffstat (limited to 'src/ipcpd/normal/main.c')
-rw-r--r--src/ipcpd/normal/main.c41
1 files changed, 6 insertions, 35 deletions
diff --git a/src/ipcpd/normal/main.c b/src/ipcpd/normal/main.c
index e6dd6717..6cfea4bc 100644
--- a/src/ipcpd/normal/main.c
+++ b/src/ipcpd/normal/main.c
@@ -182,29 +182,18 @@ static int bootstrap_components(void)
return 0;
}
-static int enroll_components(uint64_t peer)
-{
- if (dir_enroll(peer)) {
- log_err("Failed to enroll directory.");
- return -1;
- }
-
- return 0;
-}
-
static int normal_ipcp_enroll(const char * dst,
struct dif_info * info)
{
- struct conn er_conn;
- struct conn dt_conn;
+ struct conn conn;
- if (connmgr_alloc(AEID_ENROLL, dst, NULL, &er_conn)) {
+ if (connmgr_alloc(AEID_ENROLL, dst, NULL, &conn)) {
log_err("Failed to get connection.");
goto fail_er_flow;
}
/* Get boot state from peer. */
- if (enroll_boot(&er_conn)) {
+ if (enroll_boot(&conn)) {
log_err("Failed to get boot information.");
goto fail_enroll_boot;
}
@@ -219,29 +208,15 @@ static int normal_ipcp_enroll(const char * dst,
goto fail_dt_start;
}
- if (connmgr_alloc(AEID_DT, dst, NULL, &dt_conn)) {
- log_err("Failed to create a data transfer flow.");
- goto fail_dt_flow;
- }
-
if (start_components()) {
log_err("Failed to start components.");
goto fail_start_comp;
}
- if (enroll_components(dt_conn.conn_info.addr)) {
- enroll_done(&er_conn, -1);
- log_err("Failed to enroll components.");
- goto fail_enroll_comp;
- }
-
- if (enroll_done(&er_conn, 0))
+ if (enroll_done(&conn, 0))
log_warn("Failed to confirm enrollment with peer.");
- if (connmgr_dealloc(AEID_DT, &dt_conn))
- log_warn("Failed to deallocate data transfer flow.");
-
- if (connmgr_dealloc(AEID_ENROLL, &er_conn))
+ if (connmgr_dealloc(AEID_ENROLL, &conn))
log_warn("Failed to deallocate enrollment flow.");
log_info("Enrolled with %s.", dst);
@@ -251,16 +226,12 @@ static int normal_ipcp_enroll(const char * dst,
return 0;
- fail_enroll_comp:
- stop_components();
fail_start_comp:
- connmgr_dealloc(AEID_DT, &dt_conn);
- fail_dt_flow:
dt_stop();
fail_dt_start:
finalize_components();
fail_enroll_boot:
- connmgr_dealloc(AEID_ENROLL, &er_conn);
+ connmgr_dealloc(AEID_ENROLL, &conn);
fail_er_flow:
return -1;
}