Index: module-dvbapi.c =================================================================== --- module-dvbapi.c (revision 11176) +++ module-dvbapi.c (working copy) @@ -5051,7 +5051,7 @@ struct s_auth *account; int32_t ok = 0; uint16_t client_proto_version[maxpfdsize]; - uint16_t unassoc_client_proto_version[MAX_DEMUX]; + uint16_t unassoc_migrate_pfdindex[MAX_DEMUX]; if(!cs_malloc(&mbuf, sizeof(uchar)*mbuf_size)) { @@ -5088,7 +5088,7 @@ memset(ca_fd, 0, sizeof(ca_fd)); memset(unassoc_fd, 0, sizeof(unassoc_fd)); - memset(unassoc_client_proto_version, 0, sizeof(unassoc_client_proto_version)); + memset(unassoc_migrate_pfdindex, 0, sizeof(unassoc_migrate_pfdindex)); dvbapi_read_priority(); dvbapi_load_channel_cache(); @@ -5210,9 +5210,18 @@ if (unassoc_fd[i]) { pfd2[pfdcount].fd = unassoc_fd[i]; pfd2[pfdcount].events = (POLLIN | POLLPRI); - if (unassoc_client_proto_version[i]) { - client_proto_version[pfdcount] = unassoc_client_proto_version[i]; - unassoc_client_proto_version[i] = 0; + g = unassoc_migrate_pfdindex[i]; + // migrate from another poll index + if (g-- > 0) { + client_proto_version[pfdcount] = client_proto_version[g]; + client_proto_version[g] = 0; + unhandled_buf_len[pfdcount] = unhandled_buf_len[g]; + unhandled_buf_len[g] = 0; + unhandled_buf_used[pfdcount] = unhandled_buf_used[g]; + unhandled_buf_used[g] = 0; + unhandled_buf[pfdcount] = unhandled_buf[g]; + unhandled_buf[g] = NULL; + unassoc_migrate_pfdindex[i] = 0; } type[pfdcount++] = 1; } @@ -5613,7 +5622,7 @@ for (j = 0; j < MAX_DEMUX; j++) { if (!unassoc_fd[j]) { unassoc_fd[j] = connfd; - unassoc_client_proto_version[j] = client_proto_version[i]; + unassoc_migrate_pfdindex[j] = i + 1; break; } }