Merge branch 'master' of projectlivestream.com:pls

This commit is contained in:
Erik Zandvliet 2010-11-08 19:15:00 +01:00
commit 03ff4600eb
2 changed files with 11 additions and 2 deletions

View file

@ -160,6 +160,8 @@ int main(int argc, char ** argv){
} }
} }
//#ifdef DEBUG //#ifdef DEBUG
if (socketError){fprintf(stderr, "socketError\n");}
if (All_Hell_Broke_Loose){fprintf(stderr, "All Hell Broke Loose\n");}
fprintf(stderr, "User %i disconnected.\n", CONN_fd); fprintf(stderr, "User %i disconnected.\n", CONN_fd);
//#endif //#endif
return 0; return 0;

View file

@ -35,7 +35,11 @@ bool ReadUntil(char * buffer, unsigned int count, unsigned int & sofar, int sock
if (sofar >= count){return true;} if (sofar >= count){return true;}
int r = 0; int r = 0;
r = DDV_iread(buffer + sofar,count-sofar,sock); r = DDV_iread(buffer + sofar,count-sofar,sock);
if (r < 0){All_Hell_Broke_Loose = true; return false;} if (r < 0){
All_Hell_Broke_Loose = true;
fprintf(stderr, "ReadUntil fail: %s. All Hell Broke Loose!\n", strerror(errno));
return false;
}
sofar += r; sofar += r;
if (sofar >= count){return true;} if (sofar >= count){return true;}
return false; return false;
@ -63,7 +67,10 @@ bool FLV_GetPacket(FLV_Pack *& p, int sock){
if (FLV_Checkheader(p->data)){ if (FLV_Checkheader(p->data)){
sofar = 0; sofar = 0;
memcpy(FLVHeader, p->data, 13); memcpy(FLVHeader, p->data, 13);
}else{All_Hell_Broke_Loose = true;} }else{
All_Hell_Broke_Loose = true;
fprintf(stderr, "Invalid FLV header. All Hell Broke Loose!\n");
}
} }
}else{ }else{
//if a tag header, calculate length and read tag body //if a tag header, calculate length and read tag body