As far as I can figure out, an obex_t instance which makes a request
(obex client) should never get into a state with MODE_SRV set. This
breaks proper dispatching of events and so on.

And so I assume that those MODE_SRV assignments in obex_client.c were
some kind of mistake. The patch fixes it.
---
 lib/obex_client.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/obex_client.c b/lib/obex_client.c
index 2ef636e..291cacf 100644
--- a/lib/obex_client.c
+++ b/lib/obex_client.c
@@ -88,7 +88,7 @@ int obex_client(obex_t *self, buf_t *msg, int final)
                         * Jean II */
                        if (self->object->opcode == OBEX_CMD_CONNECT ||
                                        obex_object_receive(self, msg) < 0) {
-                               self->state = MODE_SRV | STATE_IDLE;
+                               self->state = MODE_CLI | STATE_IDLE;
                                obex_deliver_event(self, OBEX_EV_PARSEERR, 
self->object->opcode, 0, TRUE);
                                return -1;
                        }
@@ -134,7 +134,7 @@ int obex_client(obex_t *self, buf_t *msg, int final)
                if (self->object->opcode == OBEX_CMD_CONNECT) {
                        DEBUG(2, "We expect a connect-rsp\n");
                        if (obex_parse_connect_header(self, msg) < 0) {
-                               self->state = MODE_SRV | STATE_IDLE;
+                               self->state = MODE_CLI | STATE_IDLE;
                                obex_deliver_event(self, OBEX_EV_PARSEERR, 
self->object->opcode, 0, TRUE);
                                return -1;
                        }
@@ -149,7 +149,7 @@ int obex_client(obex_t *self, buf_t *msg, int final)
 
                /* Receive any headers */
                if (obex_object_receive(self, msg) < 0) {
-                       self->state = MODE_SRV | STATE_IDLE;
+                       self->state = MODE_CLI | STATE_IDLE;
                        obex_deliver_event(self, OBEX_EV_PARSEERR, 
self->object->opcode, 0, TRUE);
                        return -1;
                }
@@ -179,7 +179,7 @@ int obex_client(obex_t *self, buf_t *msg, int final)
                } else {
                        /* Notify app that client-operation is done! */
                        DEBUG(3, "Done! Rsp=%02x!\n", rsp);
-                       self->state = MODE_SRV | STATE_IDLE;
+                       self->state = MODE_CLI | STATE_IDLE;
                        if (self->object->abort) {
                                if (rsp == OBEX_RSP_SUCCESS)
                                        obex_deliver_event(self, OBEX_EV_ABORT, 
self->object->opcode, rsp, TRUE);
-- 
1.7.1


------------------------------------------------------------------------------
Achieve Improved Network Security with IP and DNS Reputation.
Defend against bad network traffic, including botnets, malware, 
phishing sites, and compromised hosts - saving your company time, 
money, and embarrassment.   Learn More! 
http://p.sf.net/sfu/hpdev2dev-nov
_______________________________________________
Openobex-users mailing list
Openobex-users@lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/openobex-users

Reply via email to