New handshake, data timeout after 2 seconds
This commit is contained in:
parent
654acfb412
commit
d6f6d21af1
2 changed files with 8 additions and 3 deletions
|
@ -1,6 +1,6 @@
|
||||||
#undef OLDHANDSHAKE //change to #define for old handshake method
|
#undef OLDHANDSHAKE //change to #define for old handshake method
|
||||||
|
|
||||||
char versionstring[] = "PLSRTMPServer";
|
char versionstring[] = "WWW.DDVTECH.COM ";
|
||||||
|
|
||||||
#ifdef OLDHANDSHAKE
|
#ifdef OLDHANDSHAKE
|
||||||
struct Handshake {
|
struct Handshake {
|
||||||
|
|
|
@ -117,6 +117,7 @@ int main(int argc, char ** argv){
|
||||||
FLV_Pack * tag = 0;
|
FLV_Pack * tag = 0;
|
||||||
|
|
||||||
//first timestamp set
|
//first timestamp set
|
||||||
|
int lastcheck = getNowMS();
|
||||||
firsttime = getNowMS();
|
firsttime = getNowMS();
|
||||||
|
|
||||||
if (doHandshake()){
|
if (doHandshake()){
|
||||||
|
@ -155,7 +156,10 @@ int main(int argc, char ** argv){
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case -1: break;//not ready yet
|
case -1: break;//not ready yet
|
||||||
default: parseChunk(); break;
|
default:
|
||||||
|
parseChunk();
|
||||||
|
lastcheck = getNowMS();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ready4data){
|
if (ready4data){
|
||||||
|
@ -209,6 +213,7 @@ int main(int argc, char ** argv){
|
||||||
tag->data[6] = ftst % 256;
|
tag->data[6] = ftst % 256;
|
||||||
}
|
}
|
||||||
SendMedia((unsigned char)tag->data[0], (unsigned char *)tag->data+11, tag->len-15, ts);
|
SendMedia((unsigned char)tag->data[0], (unsigned char *)tag->data+11, tag->len-15, ts);
|
||||||
|
lastcheck = getNowMS();
|
||||||
#if DEBUG >= 4
|
#if DEBUG >= 4
|
||||||
fprintf(stderr, "Sent a tag to %i\n", CONN_fd);
|
fprintf(stderr, "Sent a tag to %i\n", CONN_fd);
|
||||||
#endif
|
#endif
|
||||||
|
@ -217,7 +222,7 @@ int main(int argc, char ** argv){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//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) || (getNowMS() - lastcheck > 1)){
|
||||||
rec_window_at = rec_cnt;
|
rec_window_at = rec_cnt;
|
||||||
SendCTL(3, rec_cnt);//send ack (msg 3)
|
SendCTL(3, rec_cnt);//send ack (msg 3)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue