Mercurial > pidgin.yaz
comparison libpurple/protocols/msn/directconn.c @ 21000:89c7be36fd61
propagate from branch 'im.pidgin.pidgin.2.2.2' (head 0adab134b7a42e144aee3ac60d825db1f28a42a4)
to branch 'im.pidgin.pidgin' (head 4e59fcb1e2baf2eb63083224381e0af9fe1331cc)
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Tue, 23 Oct 2007 17:27:12 +0000 |
parents | 04fe5601fedb d9cbd249619b |
children | 3225c99785b8 |
comparison
equal
deleted
inserted
replaced
20374:535de68c9d09 | 21000:89c7be36fd61 |
---|---|
74 | 74 |
75 /************************************************************************** | 75 /************************************************************************** |
76 * Connection Functions | 76 * Connection Functions |
77 **************************************************************************/ | 77 **************************************************************************/ |
78 | 78 |
79 #if 0 | |
80 static int | 79 static int |
81 create_listener(int port) | 80 create_listener(int port) |
82 { | 81 { |
83 int fd; | 82 int fd; |
84 int flags; | 83 int flags; |
160 flags = fcntl(fd, F_GETFL); | 159 flags = fcntl(fd, F_GETFL); |
161 fcntl(fd, F_SETFL, flags | O_NONBLOCK); | 160 fcntl(fd, F_SETFL, flags | O_NONBLOCK); |
162 | 161 |
163 return fd; | 162 return fd; |
164 } | 163 } |
165 #endif | |
166 | 164 |
167 static size_t | 165 static size_t |
168 msn_directconn_write(MsnDirectConn *directconn, | 166 msn_directconn_write(MsnDirectConn *directconn, |
169 const char *data, size_t len) | 167 const char *data, size_t len) |
170 { | 168 { |
288 if (len <= 0) | 286 if (len <= 0) |
289 { | 287 { |
290 /* ERROR */ | 288 /* ERROR */ |
291 purple_debug_error("msn", "error reading\n"); | 289 purple_debug_error("msn", "error reading\n"); |
292 | 290 |
291 if (directconn->inpa) | |
292 purple_input_remove(directconn->inpa); | |
293 | |
294 close(directconn->fd); | |
295 | |
293 msn_directconn_destroy(directconn); | 296 msn_directconn_destroy(directconn); |
294 | 297 |
295 return; | 298 return; |
296 } | 299 } |
297 | 300 |
301 | 304 |
302 if (body_len <= 0) | 305 if (body_len <= 0) |
303 { | 306 { |
304 /* ERROR */ | 307 /* ERROR */ |
305 purple_debug_error("msn", "error reading\n"); | 308 purple_debug_error("msn", "error reading\n"); |
309 | |
310 if (directconn->inpa) | |
311 purple_input_remove(directconn->inpa); | |
312 | |
313 close(directconn->fd); | |
306 | 314 |
307 msn_directconn_destroy(directconn); | 315 msn_directconn_destroy(directconn); |
308 | 316 |
309 return; | 317 return; |
310 } | 318 } |
348 else | 356 else |
349 { | 357 { |
350 /* ERROR */ | 358 /* ERROR */ |
351 purple_debug_error("msn", "error reading\n"); | 359 purple_debug_error("msn", "error reading\n"); |
352 | 360 |
361 if (directconn->inpa) | |
362 purple_input_remove(directconn->inpa); | |
363 | |
364 close(directconn->fd); | |
365 | |
353 msn_directconn_destroy(directconn); | 366 msn_directconn_destroy(directconn); |
354 } | 367 } |
355 } | 368 } |
356 | 369 |
357 static void | 370 static void |
358 connect_cb(gpointer data, gint source, const gchar *error_message) | 371 connect_cb(gpointer data, gint source, PurpleInputCondition cond) |
359 { | 372 { |
360 MsnDirectConn* directconn; | 373 MsnDirectConn* directconn; |
361 int fd; | 374 int fd; |
362 | 375 |
363 purple_debug_misc("msn", "directconn: connect_cb: %d\n", source); | 376 purple_debug_misc("msn", "directconn: connect_cb: %d, %d.\n", source, cond); |
364 | 377 |
365 directconn = data; | 378 directconn = data; |
366 directconn->connect_data = NULL; | 379 directconn->connect_data = NULL; |
367 | 380 |
368 if (TRUE) | 381 if (TRUE) |
438 host, port, directconn_connect_cb, directconn); | 451 host, port, directconn_connect_cb, directconn); |
439 | 452 |
440 return (directconn->connect_data != NULL); | 453 return (directconn->connect_data != NULL); |
441 } | 454 } |
442 | 455 |
443 #if 0 | |
444 void | 456 void |
445 msn_directconn_listen(MsnDirectConn *directconn) | 457 msn_directconn_listen(MsnDirectConn *directconn) |
446 { | 458 { |
447 int port; | 459 int port; |
448 int fd; | 460 int fd; |
458 directconn); | 470 directconn); |
459 | 471 |
460 directconn->port = port; | 472 directconn->port = port; |
461 directconn->c = 0; | 473 directconn->c = 0; |
462 } | 474 } |
463 #endif | |
464 | 475 |
465 MsnDirectConn* | 476 MsnDirectConn* |
466 msn_directconn_new(MsnSlpLink *slplink) | 477 msn_directconn_new(MsnSlpLink *slplink) |
467 { | 478 { |
468 MsnDirectConn *directconn; | 479 MsnDirectConn *directconn; |