From dd7967863aac3f3ecf359c8f20ef2bae46e212db Mon Sep 17 00:00:00 2001 From: bdemsky Date: Sat, 15 Sep 2007 07:40:04 +0000 Subject: [PATCH] my bug fixes...make stuff work locally and remote --- Robust/src/Runtime/DSTM/interface/dstm.c | 4 - Robust/src/Runtime/DSTM/interface/dstm.h | 12 +- .../src/Runtime/DSTM/interface/dstmserver.c | 241 +++++++++--------- Robust/src/Runtime/DSTM/interface/plookup.c | 81 +++--- Robust/src/Runtime/DSTM/interface/trans.c | 37 ++- 5 files changed, 205 insertions(+), 170 deletions(-) diff --git a/Robust/src/Runtime/DSTM/interface/dstm.c b/Robust/src/Runtime/DSTM/interface/dstm.c index e404925e..a7a8cf40 100644 --- a/Robust/src/Runtime/DSTM/interface/dstm.c +++ b/Robust/src/Runtime/DSTM/interface/dstm.c @@ -4,10 +4,6 @@ extern int classsize[]; /* BEGIN object header */ -// Get the size of the object for a given type -unsigned int objSize(objheader_t *object) { - return classsize[TYPE(object)]; -} /* END object header */ diff --git a/Robust/src/Runtime/DSTM/interface/dstm.h b/Robust/src/Runtime/DSTM/interface/dstm.h index 766398b6..efbc4a6b 100644 --- a/Robust/src/Runtime/DSTM/interface/dstm.h +++ b/Robust/src/Runtime/DSTM/interface/dstm.h @@ -81,6 +81,15 @@ typedef struct objheader { #define TYPE(x)\ ((struct ___Object___ *)((unsigned int) x + sizeof(objheader_t)))->type +#define GETSIZE(size, x) {\ + int type=TYPE(x);\ + if (type___length___+sizeof(struct ArrayObject);\ + }\ +} + #else typedef struct objheader { @@ -94,7 +103,7 @@ typedef struct objheader { #define OID(x) x->oid #define TYPE(x) x->type #define STATUS(x) x->status - +#define GETSIZE(size, x) size=classsize[TYPE(x)] #endif @@ -183,7 +192,6 @@ int dstmInit(void); /* Prototypes for object header */ unsigned int getNewOID(void); -unsigned int objSize(objheader_t *object); /* end object header */ /* Prototypes for object store */ diff --git a/Robust/src/Runtime/DSTM/interface/dstmserver.c b/Robust/src/Runtime/DSTM/interface/dstmserver.c index 4c3758f8..4ddf42a3 100644 --- a/Robust/src/Runtime/DSTM/interface/dstmserver.c +++ b/Robust/src/Runtime/DSTM/interface/dstmserver.c @@ -129,7 +129,9 @@ void *dstmAccept(void *acceptfd) } srcObj = mhashSearch(oid); h = (objheader_t *) srcObj; - size = sizeof(objheader_t) + sizeof(classsize[TYPE(h)]); + GETSIZE(size, h); + size += sizeof(objheader_t); + if (h == NULL) { ctrl = OBJECT_NOT_FOUND; if(send((int)acceptfd, &ctrl, sizeof(char), MSG_NOSIGNAL) < sizeof(char)) { @@ -272,10 +274,12 @@ int readClientReq(trans_commit_data_t *transinfo, int acceptfd) { oidmod = (unsigned int *) calloc(fixed.nummod, sizeof(unsigned int)); ptr = (char *) modptr; for(i = 0 ; i < fixed.nummod; i++) { - headaddr = (objheader_t *) ptr; - oid = OID(headaddr); - oidmod[i] = oid; - ptr += sizeof(objheader_t) + classsize[TYPE(headaddr)]; + int tmpsize; + headaddr = (objheader_t *) ptr; + oid = OID(headaddr); + oidmod[i] = oid; + GETSIZE(tmpsize, headaddr); + ptr += sizeof(objheader_t) + tmpsize; } /*Process the information read */ @@ -319,9 +323,11 @@ int processClientReq(fixed_data_t *fixed, trans_commit_data_t *transinfo, /* Set all ref counts as 1 and do garbage collection */ ptr = modptr; for(i = 0; i< fixed->nummod; i++) { - tmp_header = (objheader_t *)ptr; - tmp_header->rcount = 0; - ptr += sizeof(objheader_t) + classsize[TYPE(tmp_header)]; + int tmpsize; + tmp_header = (objheader_t *)ptr; + tmp_header->rcount = 0; + GETSIZE(tmpsize, tmp_header); + ptr += sizeof(objheader_t) + tmpsize; } /* Unlock objects that was locked due to this transaction */ for(i = 0; i< transinfo->numlocked; i++) { @@ -403,10 +409,12 @@ char handleTransReq(fixed_data_t *fixed, trans_commit_data_t *transinfo, unsigne incr += sizeof(unsigned int); version = *((short *)(objread + incr)); } else {//Objs modified - headptr = (objheader_t *) ptr; - oid = OID(headptr); - version = headptr->version; - ptr += sizeof(objheader_t) + classsize[TYPE(headptr)]; + int tmpsize; + headptr = (objheader_t *) ptr; + oid = OID(headptr); + version = headptr->version; + GETSIZE(tmpsize, headptr); + ptr += sizeof(objheader_t) + tmpsize; } /* Check if object is still present in the machine since the beginning of TRANS_REQUEST */ @@ -540,8 +548,11 @@ int transCommitProcess(void *modptr, unsigned int *oidmod, unsigned int *oidlock /* Change ptr address in mhash table */ mhashRemove(oidmod[i]); mhashInsert(oidmod[i], (((char *)modptr) + offset)); - offset += sizeof(objheader_t) + classsize[TYPE(header)]; - + { + int tmpsize; + GETSIZE(tmpsize,header); + offset += sizeof(objheader_t) + tmpsize; + } /* Update object version number */ header = (objheader_t *) mhashSearch(oidmod[i]); header->version += 1; @@ -573,107 +584,107 @@ int transCommitProcess(void *modptr, unsigned int *oidmod, unsigned int *oidlock * then use offset values to prefetch references to other objects */ int prefetchReq(int acceptfd) { - int i, length, sum, n, numbytes, numoffset, N, objnotfound = 0, size, count = 0; - unsigned int oid, index = 0; - char *ptr, buffer[PRE_BUF_SIZE]; - void *mobj; - unsigned int objoid; - char *header, control; - objheader_t * head; - int bytesRecvd; - - /* Repeatedly recv the oid and offset pairs sent for prefetch */ - while(numbytes = recv((int)acceptfd, &length, sizeof(int), 0) != 0) { - count++; - if(length == -1) - break; - sum = 0; - index = sizeof(unsigned int); // Index starts with sizeof unsigned int because the - // first 4 bytes are saved to send the - // size of the buffer (that is computed at the end of the loop) - bytesRecvd = 0; - do { - bytesRecvd += recv((int)acceptfd, (char *)&oid +bytesRecvd, - sizeof(unsigned int) - bytesRecvd, 0); - } while (bytesRecvd < sizeof(unsigned int)); - numoffset = (length - (sizeof(int) + sizeof(unsigned int)))/ sizeof(short); - N = numoffset * sizeof(short); - short offset[numoffset]; - ptr = (char *)&offset; - /* Recv the offset values per oid */ - do { - n = recv((int)acceptfd, (void *)ptr+sum, N-sum, 0); - sum += n; - } while(sum < N && n != 0); - - /* Process each oid */ - if ((mobj = mhashSearch(oid)) == NULL) {/* Obj not found */ - /* Save the oids not found in buffer for later use */ - *(buffer + index) = OBJECT_NOT_FOUND; - index += sizeof(char); - memcpy(buffer+index, &oid, sizeof(unsigned int)); - index += sizeof(unsigned int); - } else { /* If Obj found in machine (i.e. has not moved) */ - /* send the oid, it's size, it's header and data */ - header = (char *) mobj; - head = (objheader_t *) header; - size = sizeof(objheader_t) + sizeof(classsize[TYPE(head)]); - *(buffer + index) = OBJECT_FOUND; - index += sizeof(char); - memcpy(buffer+index, &oid, sizeof(unsigned int)); - index += sizeof(unsigned int); - memcpy(buffer+index, &size, sizeof(int)); - index += sizeof(int); - memcpy(buffer + index, header, size); - index += size; - /* Calculate the oid corresponding to the offset value */ - for(i = 0 ; i< numoffset ; i++) { - objoid = *((int *)(header + sizeof(objheader_t) + offset[i])); - if((header = (char *) mhashSearch(objoid)) == NULL) { - /* Obj not found, send oid */ - *(buffer + index) = OBJECT_NOT_FOUND; - index += sizeof(char); - memcpy(buffer+index, &oid, sizeof(unsigned int)); - index += sizeof(unsigned int); - break; - } else {/* Obj Found */ - /* send the oid, it's size, it's header and data */ - head = (objheader_t *) header; - size = sizeof(objheader_t) + sizeof(classsize[TYPE(head)]); - *(buffer + index) = OBJECT_FOUND; - index += sizeof(char); - memcpy(buffer+index, &oid, sizeof(unsigned int)); - index += sizeof(unsigned int); - memcpy(buffer+index, &size, sizeof(int)); - index += sizeof(int); - memcpy(buffer + index, header, size); - index += size; - continue; - } - } - } - /* Check for overflow in the buffer */ - if (index >= PRE_BUF_SIZE) { - printf("Char buffer is overflowing\n"); - return 1; - } - /* Send Prefetch response control message only once*/ - if(count == 1) { - control = TRANS_PREFETCH_RESPONSE; - if((numbytes = send(acceptfd, &control, sizeof(char), MSG_NOSIGNAL)) < sizeof(char)) { - perror("Error in sending PREFETCH RESPONSE to Coordinator\n"); - return 1; - } - } - - /* Add the buffer size into buffer as a parameter */ - *((unsigned int *)buffer)=index; - /* Send the entire buffer with its size and oids found and not found */ - if(send((int)acceptfd, &buffer, index, MSG_NOSIGNAL) < sizeof(index -1)) { - perror("Error sending oids found\n"); - return 1; - } + int i, length, sum, n, numbytes, numoffset, N, objnotfound = 0, size, count = 0; + unsigned int oid, index = 0; + char *ptr, buffer[PRE_BUF_SIZE]; + void *mobj; + unsigned int objoid; + char control; + objheader_t * header; + int bytesRecvd; + + /* Repeatedly recv the oid and offset pairs sent for prefetch */ + while(numbytes = recv((int)acceptfd, &length, sizeof(int), 0) != 0) { + count++; + if(length == -1) + break; + sum = 0; + index = sizeof(unsigned int); // Index starts with sizeof unsigned int because the + // first 4 bytes are saved to send the + // size of the buffer (that is computed at the end of the loop) + bytesRecvd = 0; + do { + bytesRecvd += recv((int)acceptfd, (char *)&oid +bytesRecvd, + sizeof(unsigned int) - bytesRecvd, 0); + } while (bytesRecvd < sizeof(unsigned int)); + numoffset = (length - (sizeof(int) + sizeof(unsigned int)))/ sizeof(short); + N = numoffset * sizeof(short); + short offset[numoffset]; + ptr = (char *)&offset; + /* Recv the offset values per oid */ + do { + n = recv((int)acceptfd, (void *)ptr+sum, N-sum, 0); + sum += n; + } while(sum < N && n != 0); + + /* Process each oid */ + if ((mobj = mhashSearch(oid)) == NULL) {/* Obj not found */ + /* Save the oids not found in buffer for later use */ + *(buffer + index) = OBJECT_NOT_FOUND; + index += sizeof(char); + memcpy(buffer+index, &oid, sizeof(unsigned int)); + index += sizeof(unsigned int); + } else { /* If Obj found in machine (i.e. has not moved) */ + /* send the oid, it's size, it's header and data */ + header = mobj; + GETSIZE(size, header); + size += sizeof(objheader_t); + *(buffer + index) = OBJECT_FOUND; + index += sizeof(char); + memcpy(buffer+index, &oid, sizeof(unsigned int)); + index += sizeof(unsigned int); + memcpy(buffer+index, &size, sizeof(int)); + index += sizeof(int); + memcpy(buffer + index, header, size); + index += size; + /* Calculate the oid corresponding to the offset value */ + for(i = 0 ; i< numoffset ; i++) { + objoid = *((int *)(((char *)header) + sizeof(objheader_t) + offset[i])); + if((header = mhashSearch(objoid)) == NULL) { + /* Obj not found, send oid */ + *(buffer + index) = OBJECT_NOT_FOUND; + index += sizeof(char); + memcpy(buffer+index, &oid, sizeof(unsigned int)); + index += sizeof(unsigned int); + break; + } else {/* Obj Found */ + /* send the oid, it's size, it's header and data */ + GETSIZE(size, header); + size+=sizeof(objheader_t); + *(buffer + index) = OBJECT_FOUND; + index += sizeof(char); + memcpy(buffer+index, &oid, sizeof(unsigned int)); + index += sizeof(unsigned int); + memcpy(buffer+index, &size, sizeof(int)); + index += sizeof(int); + memcpy(buffer + index, header, size); + index += size; + continue; } - return 0; + } + } + /* Check for overflow in the buffer */ + if (index >= PRE_BUF_SIZE) { + printf("Char buffer is overflowing\n"); + return 1; + } + /* Send Prefetch response control message only once*/ + if(count == 1) { + control = TRANS_PREFETCH_RESPONSE; + if((numbytes = send(acceptfd, &control, sizeof(char), MSG_NOSIGNAL)) < sizeof(char)) { + perror("Error in sending PREFETCH RESPONSE to Coordinator\n"); + return 1; + } + } + + /* Add the buffer size into buffer as a parameter */ + *((unsigned int *)buffer)=index; + /* Send the entire buffer with its size and oids found and not found */ + if(send((int)acceptfd, &buffer, index, MSG_NOSIGNAL) < sizeof(index -1)) { + perror("Error sending oids found\n"); + return 1; + } + } + return 0; } diff --git a/Robust/src/Runtime/DSTM/interface/plookup.c b/Robust/src/Runtime/DSTM/interface/plookup.c index b62aa661..1752c36c 100644 --- a/Robust/src/Runtime/DSTM/interface/plookup.c +++ b/Robust/src/Runtime/DSTM/interface/plookup.c @@ -50,49 +50,56 @@ plistnode_t *pInsert(plistnode_t *pile, objheader_t *headeraddr, unsigned int mi //Add oid into a machine that is already present in the pile linked list structure while(tmp != NULL) { if (tmp->mid == mid) { - if (STATUS(headeraddr) & NEW) { - tmp->oidcreated[tmp->numcreated] = OID(headeraddr); - tmp->numcreated = tmp->numcreated + 1; - tmp->sum_bytes += sizeof(objheader_t) + classsize[TYPE(headeraddr)]; - }else if (STATUS(headeraddr) & DIRTY) { - tmp->oidmod[tmp->nummod] = OID(headeraddr); - tmp->nummod = tmp->nummod + 1; - tmp->sum_bytes += sizeof(objheader_t) + classsize[TYPE(headeraddr)]; - } else { - offset = (sizeof(unsigned int) + sizeof(short)) * tmp->numread; - *((unsigned int *)(tmp->objread + offset))=OID(headeraddr); - offset += sizeof(unsigned int); - memcpy(tmp->objread + offset, &headeraddr->version, sizeof(short)); - tmp->numread = tmp->numread + 1; - } - found = 1; - break; + int tmpsize; + + if (STATUS(headeraddr) & NEW) { + tmp->oidcreated[tmp->numcreated] = OID(headeraddr); + tmp->numcreated = tmp->numcreated + 1; + GETSIZE(tmpsize, headeraddr); + tmp->sum_bytes += sizeof(objheader_t) + tmpsize; + }else if (STATUS(headeraddr) & DIRTY) { + tmp->oidmod[tmp->nummod] = OID(headeraddr); + tmp->nummod = tmp->nummod + 1; + GETSIZE(tmpsize, headeraddr); + tmp->sum_bytes += sizeof(objheader_t) + tmpsize; + } else { + offset = (sizeof(unsigned int) + sizeof(short)) * tmp->numread; + *((unsigned int *)(tmp->objread + offset))=OID(headeraddr); + offset += sizeof(unsigned int); + memcpy(tmp->objread + offset, &headeraddr->version, sizeof(short)); + tmp->numread = tmp->numread + 1; + } + found = 1; + break; } tmp = tmp->next; } //Add oid for any new machine if (!found) { - if((ptr = pCreate(num_objs)) == NULL) { - return NULL; - } - ptr->mid = mid; - if (STATUS(headeraddr) & NEW) { - ptr->oidcreated[ptr->numcreated] = OID(headeraddr); - ptr->numcreated = ptr->numcreated + 1; - ptr->sum_bytes += sizeof(objheader_t) + classsize[TYPE(headeraddr)]; - } else if (STATUS(headeraddr) & DIRTY) { - ptr->oidmod[ptr->nummod] = OID(headeraddr); - ptr->nummod = ptr->nummod + 1; - ptr->sum_bytes += sizeof(objheader_t) + classsize[TYPE(headeraddr)]; - } else { - *((unsigned int *)ptr->objread)=OID(headeraddr); - memcpy(ptr->objread + sizeof(unsigned int), &headeraddr->version, sizeof(short)); - ptr->numread = ptr->numread + 1; - } - ptr->next = pile; - pile = ptr; + int tmpsize; + if((ptr = pCreate(num_objs)) == NULL) { + return NULL; + } + ptr->mid = mid; + if (STATUS(headeraddr) & NEW) { + ptr->oidcreated[ptr->numcreated] = OID(headeraddr); + ptr->numcreated = ptr->numcreated + 1; + GETSIZE(tmpsize, headeraddr); + ptr->sum_bytes += sizeof(objheader_t) + tmpsize; + } else if (STATUS(headeraddr) & DIRTY) { + ptr->oidmod[ptr->nummod] = OID(headeraddr); + ptr->nummod = ptr->nummod + 1; + GETSIZE(tmpsize, headeraddr); + ptr->sum_bytes += sizeof(objheader_t) + tmpsize; + } else { + *((unsigned int *)ptr->objread)=OID(headeraddr); + memcpy(ptr->objread + sizeof(unsigned int), &headeraddr->version, sizeof(short)); + ptr->numread = ptr->numread + 1; + } + ptr->next = pile; + pile = ptr; } - + /* Clear Flags */ STATUS(headeraddr) &= ~(NEW); diff --git a/Robust/src/Runtime/DSTM/interface/trans.c b/Robust/src/Runtime/DSTM/interface/trans.c index 5a82d24d..2110c037 100644 --- a/Robust/src/Runtime/DSTM/interface/trans.c +++ b/Robust/src/Runtime/DSTM/interface/trans.c @@ -208,7 +208,8 @@ objheader_t *transRead(transrecord_t *record, unsigned int oid) { } else if ((objheader = (objheader_t *) mhashSearch(oid)) != NULL) { /* Look up in machine lookup table and copy into cache*/ tmp = mhashSearch(oid); - size = sizeof(objheader_t)+classsize[TYPE(tmp)]; + GETSIZE(size, tmp); + size += sizeof(objheader_t); objcopy = objstrAlloc(record->cache, size); memcpy(objcopy, (void *)objheader, size); /* Insert into cache's lookup table */ @@ -220,7 +221,8 @@ objheader_t *transRead(transrecord_t *record, unsigned int oid) { #endif } else if((tmp = (objheader_t *) prehashSearch(oid)) != NULL) { /* Look up in prefetch cache */ found = 1; - size = sizeof(objheader_t)+classsize[TYPE(tmp)]; + GETSIZE(size, tmp); + size+=sizeof(objheader_t); objcopy = objstrAlloc(record->cache, size); memcpy(objcopy, (void *)tmp, size); /* Insert into cache's lookup table */ @@ -241,7 +243,8 @@ objheader_t *transRead(transrecord_t *record, unsigned int oid) { /* Check Prefetch cache again */ if((tmp = (objheader_t *) prehashSearch(oid)) != NULL) { /* Look up in prefetch cache */ found = 1; - size = sizeof(objheader_t)+classsize[TYPE(tmp)]; + GETSIZE(size, tmp); + size+=sizeof(objheader_t); objcopy = objstrAlloc(record->cache, size); memcpy(objcopy, (void *)tmp, size); /* Insert into cache's lookup table */ @@ -584,7 +587,8 @@ void *transRequest(void *threadarg) { for(i = 0; i < tdata->buffer->f.nummod ; i++) { int size; headeraddr = chashSearch(tdata->rec->lookupTable, tdata->buffer->oidmod[i]); - size=sizeof(objheader_t)+classsize[TYPE(headeraddr)]; + GETSIZE(size,headeraddr); + size+=sizeof(objheader_t); if (send(sd, headeraddr, size, MSG_NOSIGNAL) < size) { perror("Error sending obj modified for thread\n"); pthread_exit(NULL); @@ -834,14 +838,16 @@ void *handleLocalReq(void *threadarg) { /* Write modified objects into the mainobject store */ for(i = 0; i< localtdata->tdata->buffer->f.nummod; i++) { headeraddr = chashSearch(localtdata->tdata->rec->lookupTable, localtdata->tdata->buffer->oidmod[i]); - size = sizeof(objheader_t) + classsize[TYPE(headeraddr)]; + GETSIZE(size,headeraddr); + size+=sizeof(objheader_t); memcpy(modptr+offset, headeraddr, size); offset += size; } /* Write new objects into the mainobject store */ for(i = 0; i< localtdata->tdata->buffer->f.numcreated; i++) { headeraddr = chashSearch(localtdata->tdata->rec->lookupTable, localtdata->tdata->buffer->oidcreated[i]); - size = sizeof(objheader_t) + classsize[TYPE(headeraddr)]; + GETSIZE(size, headeraddr); + size+=sizeof(objheader_t); memcpy(modptr+offset, headeraddr, size); offset += size; } @@ -858,10 +864,12 @@ void *handleLocalReq(void *threadarg) { incr += sizeof(unsigned int); version = *((short *)(localtdata->tdata->buffer->objread + incr)); } else {//Objs modified + int tmpsize; headptr = (objheader_t *)ptr; oid = OID(headptr); version = headptr->version; - ptr += sizeof(objheader_t) + classsize[TYPE(headptr)]; + GETSIZE(tmpsize, headptr); + ptr += sizeof(objheader_t) + tmpsize; } /* Check if object is still present in the machine since the beginning of TRANS_REQUEST */ @@ -981,9 +989,11 @@ int transAbortProcess(void *modptr, unsigned int *objlocked, int numlocked, int /* Set all ref counts as 1 and do garbage collection */ ptr = (char *)modptr; for(i = 0; i< nummod; i++) { + int tmpsize; tmp_header = (objheader_t *)ptr; tmp_header->rcount = 0; - ptr += sizeof(objheader_t) + classsize[TYPE(tmp_header)]; + GETSIZE(tmpsize, tmp_header); + ptr += sizeof(objheader_t) + tmpsize; } /* Unlock objects that was locked due to this transaction */ for(i = 0; i< numlocked; i++) { @@ -1010,6 +1020,7 @@ int transComProcess(void *modptr, unsigned int *oidmod, unsigned int *oidcreated /* Process each modified object saved in the mainobject store */ for(i = 0; i < nummod; i++) { + int tmpsize; if((header = (objheader_t *) mhashSearch(oidmod[i])) == NULL) { printf("mhashsearch returns NULL at %s, %d\n", __FILE__, __LINE__); return 1; @@ -1020,7 +1031,8 @@ int transComProcess(void *modptr, unsigned int *oidmod, unsigned int *oidcreated /* Change ptr address in mhash table */ mhashRemove(oidmod[i]); //TODO: this shouldn't be necessary mhashInsert(oidmod[i], (((char *)modptr) + offset)); - offset += sizeof(objheader_t) + classsize[TYPE(header)]; + GETSIZE(tmpsize, header); + offset += sizeof(objheader_t) + tmpsize; /* Update object version number */ header = (objheader_t *) mhashSearch(oidmod[i]); @@ -1029,9 +1041,11 @@ int transComProcess(void *modptr, unsigned int *oidmod, unsigned int *oidcreated for (i = 0; i < numcreated; i++) { + int tmpsize; header = (objheader_t *)(((char *)modptr) + offset); mhashInsert(oidcreated[i], (((char *)modptr) + offset)); - offset += sizeof(objheader_t) + classsize[TYPE(header)]; + GETSIZE(tmpsize, header); + offset += sizeof(objheader_t) + tmpsize; lhashInsert(oidcreated[i], myIpAddr); } @@ -1450,8 +1464,6 @@ void getPrefetchResponse(int count, int sd) { if(control == TRANS_PREFETCH_RESPONSE) { /*For each oid and offset tuple sent as prefetch request to remote machine*/ while(i < count) { - /* Clear contents of buffer */ - memset(buffer, 0, RECEIVE_BUFFER_SIZE); sum = 0; index = 0; /* Read the size of buffer to be received */ @@ -1476,6 +1488,7 @@ void getPrefetchResponse(int count, int sd) { index += sizeof(unsigned int); /* For each object found add to Prefetch Cache */ memcpy(&objsize, buffer + index, sizeof(int)); + index+=sizeof(int); pthread_mutex_lock(&prefetchcache_mutex); if ((modptr = objstrAlloc(prefetchcache, objsize)) == NULL) { printf("objstrAlloc error for copying into prefetch cache %s, %d\n", __FILE__, __LINE__); -- 2.34.1