src/protocols/zephyr/ZSendPkt.c

changeset 2419
beb509dd2935
parent 2086
007508451e2c
child 7475
987384816492
equal deleted inserted replaced
2418:0de851709972 2419:beb509dd2935
18 #endif 18 #endif
19 19
20 #include <internal.h> 20 #include <internal.h>
21 #include <sys/socket.h> 21 #include <sys/socket.h>
22 22
23 static int wait_for_ack(); 23 static int wait_for_hmack();
24 24
25 Code_t ZSendPacket(packet, len, waitforack) 25 Code_t ZSendPacket(packet, len, waitforack)
26 char *packet; 26 char *packet;
27 int len; 27 int len;
28 int waitforack; 28 int waitforack;
51 return (ZERR_NONE); 51 return (ZERR_NONE);
52 52
53 if ((retval = ZParseNotice(packet, len, &notice)) != ZERR_NONE) 53 if ((retval = ZParseNotice(packet, len, &notice)) != ZERR_NONE)
54 return (retval); 54 return (retval);
55 55
56 retval = Z_WaitForNotice (&acknotice, wait_for_ack, &notice.z_uid, 56 retval = Z_WaitForNotice (&acknotice, wait_for_hmack, &notice.z_uid,
57 HM_TIMEOUT); 57 HM_TIMEOUT);
58 if (retval == ETIMEDOUT) 58 if (retval == ETIMEDOUT)
59 return ZERR_HMDEAD; 59 return ZERR_HMDEAD;
60 if (retval == ZERR_NONE) 60 if (retval == ZERR_NONE)
61 ZFreeNotice (&acknotice); 61 ZFreeNotice (&acknotice);
62 return retval; 62 return retval;
63 } 63 }
64 64
65 static int wait_for_ack(notice, uid) 65 static int wait_for_hmack(notice, uid)
66 ZNotice_t *notice; 66 ZNotice_t *notice;
67 ZUnique_Id_t *uid; 67 ZUnique_Id_t *uid;
68 { 68 {
69 return (ZCompareUID(&notice->z_uid, uid) && 69 return (notice->z_kind == HMACK && ZCompareUID(&notice->z_uid, uid));
70 (notice->z_kind == HMACK ||
71 notice->z_kind == SERVACK ||
72 notice->z_kind == CLIENTACK ));
73 } 70 }

mercurial