diff options
author | Matt Strapp <strap012@umn.edu> | 2020-10-27 14:17:49 -0500 |
---|---|---|
committer | Matt Strapp <strap012@umn.edu> | 2020-10-27 14:17:49 -0500 |
commit | 236a859791793907066a4c06b9c8f67e0e830a4a (patch) | |
tree | aac655efb3101d02be3ea1a29addcc5b787df0aa /P2 | |
parent | Fix arrangment + comment (diff) | |
download | csci4061-236a859791793907066a4c06b9c8f67e0e830a4a.tar csci4061-236a859791793907066a4c06b9c8f67e0e830a4a.tar.gz csci4061-236a859791793907066a4c06b9c8f67e0e830a4a.tar.bz2 csci4061-236a859791793907066a4c06b9c8f67e0e830a4a.tar.lz csci4061-236a859791793907066a4c06b9c8f67e0e830a4a.tar.xz csci4061-236a859791793907066a4c06b9c8f67e0e830a4a.tar.zst csci4061-236a859791793907066a4c06b9c8f67e0e830a4a.zip |
Finish getInterData???
Diffstat (limited to 'P2')
-rw-r--r-- | P2/lib/utils.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/P2/lib/utils.c b/P2/lib/utils.c index ea2ed3d..a97aa36 100644 --- a/P2/lib/utils.c +++ b/P2/lib/utils.c @@ -17,10 +17,10 @@ char *getChunkData(int mapperID) { int mid = openQueue(); msgrcv(mid, &message, sizeof(message.msgText), mapperID, 0); /*IMPLEMENT END AND ACK SOON*/ - // if (strcmp("END", message.msgText)) { - // struct msgBuffer ACK = {mapperID, "ACK"}; - // msgsnd(mid, &ACK, MSGSIZE, 0); - // } + if (strncmp("END", message.msgText, 3)) { + struct msgBuffer ACK = {mapperID, "ACK"}; + msgsnd(mid, &ACK, MSGSIZE, 0); + } return message.msgText; } @@ -40,7 +40,7 @@ void sendChunkData(char *inputFile, int nMappers) { else cut off before that word and put back file */ // TODO! help - msgsnd(msgid, &message, 11, 0); + msgsnd(msgid, &message, mapperID, 0); } for (int i = 1; i < nMappers; i++) { @@ -68,6 +68,17 @@ int hashFunction(char* Qkey, int reducers){ int getInterData(char *Qkey, int reducerID) { //make sure it work. int id = openQueue(); + struct msgBuffer message; + msgrcv(id, &message, chunkSize, reducerID, 0); + Qkey = message.msgText; + if (strncmp("END", message.msgText, 3)) + { + struct msgBuffer ACK = {reducerID, "ACK"}; + msgsnd(id, &ACK, MSGSIZE, 0); + return 0; + } else { + return 1; + } } void shuffle(int nMappers, int nReducers) { |