comparison src/dccifd.cpp @ 371:df7dc6b2b153

install dnsblnogrey/whiteclnt for dccifd
author Carl Byington <carl@five-ten-sg.com>
date Wed, 08 Feb 2017 10:03:40 -0800
parents 3fee608becbc
children 5209e92b4885
comparison
equal deleted inserted replaced
370:5380552644e2 371:df7dc6b2b153
103 103
104 104
105 void DccInterface::mlfi_header(SMFICTX *ctx, const char *headerf, const char *headerv) 105 void DccInterface::mlfi_header(SMFICTX *ctx, const char *headerf, const char *headerv)
106 { 106 {
107 if (dccifd_socket == NULL_SOCKET) Connect(); 107 if (dccifd_socket == NULL_SOCKET) Connect();
108 if (err) return;
108 if ((dccifd_socket != NULL_SOCKET) && (!dccifd_input.empty())) { 109 if ((dccifd_socket != NULL_SOCKET) && (!dccifd_input.empty())) {
109 output(dccifd_input); 110 output(dccifd_input);
110 dccifd_input = ""; 111 dccifd_input = "";
111 } 112 }
112 113
229 } 230 }
230 231
231 232
232 size_t DccInterface::my_write(const char *buf, size_t len) { 233 size_t DccInterface::my_write(const char *buf, size_t len) {
233 if (err) return 0; 234 if (err) return 0;
235
234 size_t rs = 0; 236 size_t rs = 0;
235 while (len) { 237 while (len) {
236 ssize_t ws = write(dccifd_socket, buf, len); 238 ssize_t ws = write(dccifd_socket, buf, len);
237 if (ws > 0) { 239 if (ws > 0) {
238 rs += ws; 240 rs += ws;
249 return rs; 251 return rs;
250 } 252 }
251 253
252 size_t DccInterface::my_read(char *buf, size_t len) { 254 size_t DccInterface::my_read(char *buf, size_t len) {
253 if (err) return 0; 255 if (err) return 0;
256
254 size_t rs = 0; 257 size_t rs = 0;
255 while (len) { 258 while (len) {
256 ssize_t ws = read(dccifd_socket, buf, len); 259 ssize_t ws = read(dccifd_socket, buf, len);
257 if (ws > 0) { 260 if (ws > 0) {
258 rs += ws; 261 rs += ws;
273 return rs; 276 return rs;
274 } 277 }
275 278
276 void DccInterface::output(const char* buffer, size_t size) 279 void DccInterface::output(const char* buffer, size_t size)
277 { 280 {
278 // if there are problems, fail.
279 if (err) return; 281 if (err) return;
280 282
281 // buffer it if not connected yet 283 // buffer it if not connected yet
282 if (dccifd_socket == NULL_SOCKET) { 284 if (dccifd_socket == NULL_SOCKET) {
283 //my_syslog(priv, string("dcc buffered ") + escaper(string(buffer, size))); 285 //my_syslog(priv, string("dcc buffered ") + escaper(string(buffer, size)));