Minder debugging

This commit is contained in:
Thulinma 2010-11-08 20:28:37 +01:00
parent 540e729dc6
commit 17bc2bf3b9
2 changed files with 12 additions and 4 deletions

View file

@ -91,6 +91,7 @@ int main(int argc, char ** argv){
int retval; int retval;
int poller = epoll_create(1); int poller = epoll_create(1);
int sspoller = epoll_create(1);
struct epoll_event ev; struct epoll_event ev;
ev.events = EPOLLIN; ev.events = EPOLLIN;
ev.data.fd = CONN_fd; ev.data.fd = CONN_fd;
@ -119,14 +120,17 @@ int main(int argc, char ** argv){
#endif #endif
return 0; return 0;
} }
ev.events = EPOLLIN;
ev.data.fd = ss;
epoll_ctl(sspoller, EPOLL_CTL_ADD, ss, &ev);
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "Everything connected, starting to send video data...\n"); fprintf(stderr, "Everything connected, starting to send video data...\n");
#endif #endif
inited = true; inited = true;
} }
//only send data if previous data has been ACK'ed...
//if (snd_cnt - snd_window_at < snd_window_size){ retval = epoll_wait(poller, events, 1, 50);
if (DDV_ready(ss)){ if ((retval > 0) && (DDV_ready(ss))){
if (FLV_GetPacket(tag, ss)){//able to read a full packet? if (FLV_GetPacket(tag, ss)){//able to read a full packet?
ts = tag->data[7] * 256*256*256; ts = tag->data[7] * 256*256*256;
ts += tag->data[4] * 256*256; ts += tag->data[4] * 256*256;
@ -153,7 +157,6 @@ int main(int argc, char ** argv){
#endif #endif
} }
} }
//}
} }
//send ACK if we received a whole window //send ACK if we received a whole window
if (rec_cnt - rec_window_at > rec_window_size){ if (rec_cnt - rec_window_at > rec_window_size){

View file

@ -32,6 +32,11 @@ 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 (count > 500000){
All_Hell_Broke_Loose = true;
fprintf(stderr, "ReadUntil fail: > 500kb tag? All Hell Broke Loose!\n", strerror(errno));
return false;
}
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);