| 51 | |
| 52 | |
| 53 | void on_connect ( |
| 54 | connection& con |
| 55 | ) |
| 56 | { |
| 57 | dlog << LINFO << "in serv::on_connect(): got new connection"; |
| 58 | int status; |
| 59 | int count = 0; |
| 60 | char buf[100]; |
| 61 | while ((status = con.read(buf,sizeof(buf))) > 0) |
| 62 | { |
| 63 | for (int i = 0; i < status; ++i) |
| 64 | { |
| 65 | if (buf[i] != magic_num) |
| 66 | { |
| 67 | tag = 4.0; |
| 68 | error_occurred = true; |
| 69 | } |
| 70 | } |
| 71 | count += status; |
| 72 | } |
| 73 | if (count != min_bytes_sent) |
| 74 | { |
| 75 | tag = 5.0; |
| 76 | error_occurred = true; |
| 77 | } |
| 78 | got_connections = true; |
| 79 | dlog << LINFO << "in serv::on_connect(): on_connect ending"; |
| 80 | |
| 81 | auto_mutex M(m); |
| 82 | ++num_connections; |
| 83 | s.broadcast(); |
| 84 | |
| 85 | } |
| 86 | |
| 87 | bool error_occurred; |
| 88 | bool got_connections; |