RE: write failed with errno 11
"Oded Arbel" <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Message-ID | <[email protected]> |
Terribly sorry - my bad. major oops on my side, totally stupid - happens to me all the time. I knocked my had on the walls a couple of times after I've seen this : hopefully that would cause the lesson to be learned this time around :-( Here's the new patch against today's CVS : -- Oded Arbel m-Wise mobile solutions [email protected] +972-9-9581711 (116) +972-67-340014 ::.. "The best way for civilians to understand military culture is to read 'Starship Troopers', 'The Forever War', and 'Bill the Galactic Hero' all at one sitting." > -----Original Message----- > From: Oded Arbel > Sent: Thursday, August 08, 2002 4:40 PM > To: Stephane Pointu; Kannel-devel (E-mail) > Subject: RE: write failed with errno 11 > > > > > > Yes - CMS error 500 is an unknown error, but I think I know > why it happened and it's my fault. I'm not sure yet why it > did what it did, but I'm going to fix it. > > -- > Oded Arbel > m-Wise mobile solutions > [email protected] > > +972-9-9581711 (116) > +972-67-340014 > > ::.. > "So mutable is really the prophecised anti-Const, yes?" > -- Doug Schmidt > > > -----Original Message----- > > From: Stephane Pointu [mailto:[email protected]] > > Sent: Thursday, August 08, 2002 4:32 PM > > To: 'Paul Keogh'; Kannel-devel (E-mail) > > Cc: Oded Arbel > > Subject: RE: write failed with errno 11 > > > > > > I did a make distclean and recompiled... Now i have another > > error message: > > > > 2002-08-08 16:22:29 [5] DEBUG: AT2[T68]: international > > starting with 00 > > (0033666666666) > > 2002-08-08 16:22:29 [5] DEBUG: AT2[T68]: TP-Validity-Period: > > 24.0 hours > > 2002-08-08 16:22:29 [5] DEBUG: AT2[T68]: --> AT+CMGS=21^M > > 2002-08-08 16:22:29 [5] DEBUG: AT2[T68]: <-- > > > 2002-08-08 16:22:29 [5] DEBUG: AT2[T68]: send command status: 1 > > 2002-08-08 16:22:29 [5] DEBUG: AT2[T68]: --> > > 0000000B913366567902F60000A707D4F29CEE72B900 > > 2002-08-08 16:22:29 [5] DEBUG: AT2[T68]: --> ^Z > > 2002-08-08 16:22:30 [5] DEBUG: AT2[T68]: <-- > > > 2002-08-08 16:22:30 [5] DEBUG: AT2[T68]: <-- +CMS ERROR: 500 > > 2002-08-08 16:22:30 [5] ERROR: AT2[T68]: CMS ERROR: +CMS ERROR: 500 > > 2002-08-08 16:22:30 [5] DEBUG: AT2[T68]: send command status: 1 > > > > CMS ERROR 500 is an unknown error! Is it really unknown? > > > > Stephane. > > > > > > -----Original Message----- > > From: Paul Keogh [mailto:[email protected]] > > Sent: 08 August 2002 16:06 > > To: Kannel-devel (E-mail) > > Subject: RE: write failed with errno 11 > > > > > > > > > 2002-08-08 15:25:32 [14] ERROR: Packet too short while > > > > unpacking Msg. > > > > > 2002-08-08 15:25:32 [14] ERROR: Msg packet was invalid. > > > > > 2002-08-08 15:25:32 [14] ERROR: Failed to unpack data! > > > > > > > > > This is symptomatic of a change to the Msg struct without all the > > affected modules being recompiled. I would guess that either the > > wap or sms box is out of sync with the bearer box in this respect. > > > >
smsc_at2.patch
(application/octet-stream, 2.3 KB)
--- gw/smsc_at2.c 2002-08-07 10:56:44.000000000 +0300
+++ gw/smsc_at2.c 2002-08-08 18:10:43.000000000 +0300
@@ -241,6 +241,7 @@
{
int count;
int s = 0;
+ int write_count = 0;
Octstr *linestr = NULL;
linestr = octstr_format("%s\r", line);
@@ -248,7 +249,15 @@
debug("bb.smsc.at2", 0, "AT2[%s]: --> %s^M", octstr_get_cstr(privdata->name), line);
count = octstr_len(linestr);
- s = write(privdata->fd, octstr_get_cstr(linestr), count);
+ while (1) {
+ errno = 0;
+ s = write(privdata->fd, octstr_get_cstr(linestr), count);
+ if (s < 0 && errno == EAGAIN && write_count < RETRY_SEND) {
+ gwthread_sleep(1);
+ ++write_count;
+ } else
+ break;
+ };
O_DESTROY(linestr);
if (s < 0) {
debug("bb.smsc.at2", 0, "AT2[%s]: write failed with errno %d",
@@ -266,9 +275,18 @@
{
int s;
char *ctrlz = "\032" ;
-
+ int write_count = 0;
+
debug("bb.smsc.at2", 0, "AT2[%s]: --> ^Z", octstr_get_cstr(privdata->name));
- s = write(privdata->fd, ctrlz, 1);
+ while (1) {
+ errno = 0;
+ s = write(privdata->fd, ctrlz, 1);
+ if (s < 0 && errno == EAGAIN && write_count < RETRY_SEND) {
+ gwthread_sleep(1);
+ ++write_count;
+ } else
+ break;
+ };
if (s < 0) {
debug("bb.smsc.at2", 0, "AT2[%s]: write failed with errno %d",
octstr_get_cstr(privdata->name), errno);
@@ -1517,14 +1612,18 @@
*/
/*
- * message type SUBMIT
- * 01010001 = 0x51 indicating add. UDH, TP-VP(Rel) & MSG_SUBMIT
- * or 00010001 = 0x11 for just TP-VP(Rel) & MSG_SUBMIT
+ * message type SUBMIT , bit mapped :
+ * bit7 .. bit0
+ * TP-RP , TP-UDHI, TP-SRR, TP-VPF(4), TP-VPF(3), TP-RD, TP-MTI(1), TP-MTI(0)
*/
-
- pdu[pos] = octstr_len(msg->sms.udhdata) ? at2_numtext(5) : at2_numtext(1);
+ i = (msg->sms.rpi ? 1 : 0) << 7 /* TP-RP */
+ | (octstr_len(msg->sms.udhdata) ? 1 : 0) << 6 /* TP-UDHI */
+ | ((msg->sms.dlr_mask & (DLR_SUCCESS | DLR_FAIL | DLR_BUFFERED)) ? 1 : 0) << 5 /* TP-SRR */
+ | 16 /* TP-VP(Rel)*/
+ | 1; /* TP-MTI: SUBMIT_SM */
+ pdu[pos] = at2_numtext(i >> 4);
pos++;
- pdu[pos] = at2_numtext(AT_SUBMIT_SM);
+ pdu[pos] = at2_numtext(i & 15);
pos++;
/* message reference (0 for now) */