Revert
This commit is contained in:
parent
a539b5b5c0
commit
cc1fdf7138
1 changed files with 12 additions and 9 deletions
|
@ -32,19 +32,22 @@ bool FLV_Isheader(char * header){
|
||||||
}//FLV_Isheader
|
}//FLV_Isheader
|
||||||
|
|
||||||
bool ReadUntil(char * buffer, unsigned int count, unsigned int & sofar, int sock){
|
bool ReadUntil(char * buffer, unsigned int count, unsigned int & sofar, int sock){
|
||||||
if (sofar >= count){return true;}
|
if (sofar == count){return true;}
|
||||||
fprintf(stderr, "Reading %i/%i\n", sofar, count);
|
int r = DDV_iread(buffer + sofar,count-sofar,sock);
|
||||||
if (DDV_readycount(sock) >= count-sofar){
|
if (r < 0){
|
||||||
bool r = DDV_read(buffer + sofar,count-sofar,sock);
|
if (errno != EWOULDBLOCK){
|
||||||
sofar = count;
|
|
||||||
if (!r){
|
|
||||||
All_Hell_Broke_Loose = true;
|
All_Hell_Broke_Loose = true;
|
||||||
fprintf(stderr, "ReadUntil fail: %s. All Hell Broke Loose!\n", strerror(errno));
|
fprintf(stderr, "ReadUntil fail: %s. All Hell Broke Loose!\n", strerror(errno));
|
||||||
}
|
}
|
||||||
return r;
|
|
||||||
}else{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
sofar += r;
|
||||||
|
if (sofar == count){return true;}
|
||||||
|
if (sofar > count){
|
||||||
|
All_Hell_Broke_Loose = true;
|
||||||
|
fprintf(stderr, "ReadUntil fail: %s. Read too much. All Hell Broke Loose!\n", strerror(errno));
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//gets a packet, storing in given FLV_Pack pointer.
|
//gets a packet, storing in given FLV_Pack pointer.
|
||||||
|
@ -55,7 +58,7 @@ bool FLV_GetPacket(FLV_Pack *& p, int sock){
|
||||||
static bool done = true;
|
static bool done = true;
|
||||||
static unsigned int sofar = 0;
|
static unsigned int sofar = 0;
|
||||||
if (!p){p = (FLV_Pack*)calloc(1, sizeof(FLV_Pack));}
|
if (!p){p = (FLV_Pack*)calloc(1, sizeof(FLV_Pack));}
|
||||||
if (p->buf < 15){p->data = (char*)realloc(p->data, 5000); p->buf = 5000;}
|
if (p->buf < 15){p->data = (char*)realloc(p->data, 15); p->buf = 15;}
|
||||||
|
|
||||||
if (done){
|
if (done){
|
||||||
//read a header
|
//read a header
|
||||||
|
|
Loading…
Add table
Reference in a new issue