diff options
author | Bart Polot <bart@net.in.tum.de> | 2014-01-06 04:47:44 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2014-01-06 04:47:44 +0000 |
commit | 532ac9a55e3f2f6eaea7f6b6c38cd6a7bdbb3e6a (patch) | |
tree | 9936b1433a77faaa7aebc1f8d496a2376e165efc /src | |
parent | d6f811a963eb257548fbf82a807b234e08bb8eea (diff) | |
download | gnunet-532ac9a55e3f2f6eaea7f6b6c38cd6a7bdbb3e6a.tar.gz gnunet-532ac9a55e3f2f6eaea7f6b6c38cd6a7bdbb3e6a.zip |
- refactor channel nack
Diffstat (limited to 'src')
-rw-r--r-- | src/mesh/gnunet-service-mesh_channel.c | 2 | ||||
-rw-r--r-- | src/mesh/gnunet-service-mesh_local.c | 50 | ||||
-rw-r--r-- | src/mesh/gnunet-service-mesh_local.h | 20 | ||||
-rw-r--r-- | src/mesh/mesh_api.c | 2 |
4 files changed, 37 insertions, 37 deletions
diff --git a/src/mesh/gnunet-service-mesh_channel.c b/src/mesh/gnunet-service-mesh_channel.c index 42d9bc1cf..cb5a27973 100644 --- a/src/mesh/gnunet-service-mesh_channel.c +++ b/src/mesh/gnunet-service-mesh_channel.c | |||
@@ -636,7 +636,7 @@ send_client_nack (struct MeshChannel *ch) | |||
636 | GNUNET_break (0); | 636 | GNUNET_break (0); |
637 | return; | 637 | return; |
638 | } | 638 | } |
639 | GML_send_nack (ch->root, ch->lid_root); | 639 | GML_send_channel_nack (ch->root, ch->lid_root); |
640 | } | 640 | } |
641 | 641 | ||
642 | 642 | ||
diff --git a/src/mesh/gnunet-service-mesh_local.c b/src/mesh/gnunet-service-mesh_local.c index f6b4b8149..8fc01f929 100644 --- a/src/mesh/gnunet-service-mesh_local.c +++ b/src/mesh/gnunet-service-mesh_local.c | |||
@@ -990,31 +990,6 @@ GML_send_ack (struct MeshClient *c, MESH_ChannelNumber id) | |||
990 | } | 990 | } |
991 | 991 | ||
992 | 992 | ||
993 | /** | ||
994 | * Build a local channel NACK message and send it to a local client. | ||
995 | * | ||
996 | * @param c Client to whom send the NACK. | ||
997 | * @param id Channel ID to use | ||
998 | */ | ||
999 | void | ||
1000 | GML_send_nack (struct MeshClient *c, MESH_ChannelNumber id) | ||
1001 | { | ||
1002 | struct GNUNET_MESH_LocalAck msg; | ||
1003 | |||
1004 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1005 | "send local nack on %X towards %p\n", | ||
1006 | id, c); | ||
1007 | |||
1008 | msg.header.size = htons (sizeof (msg)); | ||
1009 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_NACK); | ||
1010 | msg.channel_id = htonl (id); | ||
1011 | GNUNET_SERVER_notification_context_unicast (nc, | ||
1012 | c->handle, | ||
1013 | &msg.header, | ||
1014 | GNUNET_NO); | ||
1015 | |||
1016 | } | ||
1017 | |||
1018 | 993 | ||
1019 | /** | 994 | /** |
1020 | * Notify the client that a new incoming channel was created. | 995 | * Notify the client that a new incoming channel was created. |
@@ -1044,6 +1019,31 @@ GML_send_channel_create (struct MeshClient *c, | |||
1044 | 1019 | ||
1045 | 1020 | ||
1046 | /** | 1021 | /** |
1022 | * Build a local channel NACK message and send it to a local client. | ||
1023 | * | ||
1024 | * @param c Client to whom send the NACK. | ||
1025 | * @param id Channel ID to use | ||
1026 | */ | ||
1027 | void | ||
1028 | GML_send_channel_nack (struct MeshClient *c, MESH_ChannelNumber id) | ||
1029 | { | ||
1030 | struct GNUNET_MESH_LocalAck msg; | ||
1031 | |||
1032 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1033 | "send local nack on %X towards %p\n", | ||
1034 | id, c); | ||
1035 | |||
1036 | msg.header.size = htons (sizeof (msg)); | ||
1037 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_CHANNEL_NACK); | ||
1038 | msg.channel_id = htonl (id); | ||
1039 | GNUNET_SERVER_notification_context_unicast (nc, | ||
1040 | c->handle, | ||
1041 | &msg.header, | ||
1042 | GNUNET_NO); | ||
1043 | |||
1044 | } | ||
1045 | |||
1046 | /** | ||
1047 | * Notify a client that a channel is no longer valid. | 1047 | * Notify a client that a channel is no longer valid. |
1048 | * | 1048 | * |
1049 | * @param c Client. | 1049 | * @param c Client. |
diff --git a/src/mesh/gnunet-service-mesh_local.h b/src/mesh/gnunet-service-mesh_local.h index a78ef7af2..c5a0b367c 100644 --- a/src/mesh/gnunet-service-mesh_local.h +++ b/src/mesh/gnunet-service-mesh_local.h | |||
@@ -160,15 +160,6 @@ void | |||
160 | GML_send_ack (struct MeshClient *c, MESH_ChannelNumber id); | 160 | GML_send_ack (struct MeshClient *c, MESH_ChannelNumber id); |
161 | 161 | ||
162 | /** | 162 | /** |
163 | * Build a local channel NACK message and send it to a local client. | ||
164 | * | ||
165 | * @param c Client to whom send the NACK. | ||
166 | * @param id Channel ID to use | ||
167 | */ | ||
168 | void | ||
169 | GML_send_nack (struct MeshClient *c, MESH_ChannelNumber id); | ||
170 | |||
171 | /** | ||
172 | * Notify the appropriate client that a new incoming channel was created. | 163 | * Notify the appropriate client that a new incoming channel was created. |
173 | * | 164 | * |
174 | * @param c Client to notify. | 165 | * @param c Client to notify. |
@@ -183,6 +174,15 @@ GML_send_channel_create (struct MeshClient *c, | |||
183 | const struct GNUNET_PeerIdentity *peer); | 174 | const struct GNUNET_PeerIdentity *peer); |
184 | 175 | ||
185 | /** | 176 | /** |
177 | * Build a local channel NACK message and send it to a local client. | ||
178 | * | ||
179 | * @param c Client to whom send the NACK. | ||
180 | * @param id Channel ID to use | ||
181 | */ | ||
182 | void | ||
183 | GML_send_channel_nack (struct MeshClient *c, MESH_ChannelNumber id); | ||
184 | |||
185 | /** | ||
186 | * Notify a client that a channel is no longer valid. | 186 | * Notify a client that a channel is no longer valid. |
187 | * | 187 | * |
188 | * @param c Client. | 188 | * @param c Client. |
@@ -223,4 +223,4 @@ GML_2s (const struct MeshClient *c); | |||
223 | 223 | ||
224 | /* ifndef GNUNET_MESH_SERVICE_LOCAL_H */ | 224 | /* ifndef GNUNET_MESH_SERVICE_LOCAL_H */ |
225 | #endif | 225 | #endif |
226 | /* end of gnunet-mesh-service_LOCAL.h */ \ No newline at end of file | 226 | /* end of gnunet-mesh-service_LOCAL.h */ |
diff --git a/src/mesh/mesh_api.c b/src/mesh/mesh_api.c index f27e86b71..5f3f2da51 100644 --- a/src/mesh/mesh_api.c +++ b/src/mesh/mesh_api.c | |||
@@ -1146,7 +1146,7 @@ msg_received (void *cls, const struct GNUNET_MessageHeader *msg) | |||
1146 | break; | 1146 | break; |
1147 | /* Notify of a channel disconnection */ | 1147 | /* Notify of a channel disconnection */ |
1148 | case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_DESTROY: /* TODO separate(gid problem)*/ | 1148 | case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_DESTROY: /* TODO separate(gid problem)*/ |
1149 | case GNUNET_MESSAGE_TYPE_MESH_LOCAL_NACK: | 1149 | case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_NACK: |
1150 | process_channel_destroy (h, (struct GNUNET_MESH_ChannelMessage *) msg); | 1150 | process_channel_destroy (h, (struct GNUNET_MESH_ChannelMessage *) msg); |
1151 | break; | 1151 | break; |
1152 | case GNUNET_MESSAGE_TYPE_MESH_LOCAL_DATA: | 1152 | case GNUNET_MESSAGE_TYPE_MESH_LOCAL_DATA: |