Project

General

Profile

Bug #3346 » oscam-migrate-ubuf.patch

Jaroslav Kysela, 2015-11-26 15:03

View differences:

module-dvbapi.c (working copy)
5051 5051
	struct s_auth *account;
5052 5052
	int32_t ok = 0;
5053 5053
	uint16_t client_proto_version[maxpfdsize];
5054
	uint16_t unassoc_client_proto_version[MAX_DEMUX];
5054
	uint16_t unassoc_migrate_pfdindex[MAX_DEMUX];
5055 5055
	
5056 5056
	if(!cs_malloc(&mbuf, sizeof(uchar)*mbuf_size))
5057 5057
	{
......
5088 5088
	
5089 5089
	memset(ca_fd, 0, sizeof(ca_fd));
5090 5090
	memset(unassoc_fd, 0, sizeof(unassoc_fd));
5091
	memset(unassoc_client_proto_version, 0, sizeof(unassoc_client_proto_version));
5091
	memset(unassoc_migrate_pfdindex, 0, sizeof(unassoc_migrate_pfdindex));
5092 5092

  
5093 5093
	dvbapi_read_priority();
5094 5094
	dvbapi_load_channel_cache();
......
5210 5210
			if (unassoc_fd[i]) {
5211 5211
				pfd2[pfdcount].fd = unassoc_fd[i];
5212 5212
				pfd2[pfdcount].events = (POLLIN | POLLPRI);
5213
				if (unassoc_client_proto_version[i]) {
5214
					client_proto_version[pfdcount] = unassoc_client_proto_version[i];
5215
					unassoc_client_proto_version[i] = 0;
5213
				g = unassoc_migrate_pfdindex[i];
5214
				// migrate from another poll index
5215
				if (g-- > 0) {
5216
					client_proto_version[pfdcount] = client_proto_version[g];
5217
					client_proto_version[g] = 0;
5218
					unhandled_buf_len[pfdcount] = unhandled_buf_len[g];
5219
					unhandled_buf_len[g] = 0;
5220
					unhandled_buf_used[pfdcount] = unhandled_buf_used[g];
5221
					unhandled_buf_used[g] = 0;
5222
					unhandled_buf[pfdcount] = unhandled_buf[g];
5223
					unhandled_buf[g] = NULL;
5224
					unassoc_migrate_pfdindex[i] = 0;
5216 5225
				}
5217 5226
				type[pfdcount++] = 1;
5218 5227
			}
......
5613 5622
							for (j = 0; j < MAX_DEMUX; j++) {
5614 5623
								if (!unassoc_fd[j]) {
5615 5624
									unassoc_fd[j] = connfd;
5616
									unassoc_client_proto_version[j] = client_proto_version[i];
5625
									unassoc_migrate_pfdindex[j] = i + 1;
5617 5626
									break;
5618 5627
								}
5619 5628
							}
(1-1/2)