35{
38 char* evtbuffer = new char[MAXEVTSIZE];
39
40
41 int loop_counter [[maybe_unused]] = 0;
42 while (m_force_exit == 0) {
43
44 int size = m_rbuf->
remq((
int*)evtbuffer);
45
46
47
48
49 int exam_stat = m_man->examine();
50
51 if (exam_stat == 0) {
52 printf("Initial connection request detected!\n");
53
54 } else if (exam_stat == 1 && size > 0) {
55
56 vector<int>& recvsock = m_man->connected_socket_list();
57
58 for (vector<int>::iterator it = recvsock.begin();
59 it != recvsock.end(); ++it) {
60 int fd = *it;
61 if (m_man->connected(fd, true)) {
62 int is = sio.put(fd, evtbuffer, size * 4);
63
64 if (is <= 0) {
65 printf("EventServer: fd %d disconnected\n", fd);
66 m_man->remove(fd);
67 break;
68 }
69 }
70 }
71 }
72 usleep(1000);
73 loop_counter++;
74 }
75 return 0;
76}
A class to encode/decode an EvtMessage.
int remq(int *buf)
Pick up a buffer from the RingBuffer.